This is a simple project demonstrating how to apply ArchUnit tests/rules to AEM projects
- ArchUnit is a Java library for checking the architecture of your Java code using Junit
- It can check dependencies between packages and classes, layers and slices, check for cyclic dependencies and more.
- For more info see: https://www.archunit.org/
Check out example AEM arhictecture tests here: https://github.com/dstr89/aem-archunit/blob/main/core/src/test/java/io/ecx/demo/core/architecture/ArchitectureRulesTest.java
The main parts of the template are:
- core: Java bundle containing all core functionality like OSGi services, listeners or schedulers, as well as component-related Java code such as servlets or request filters.
- it.tests: Java based integration tests
- ui.apps: contains the /apps (and /etc) parts of the project, ie JS&CSS clientlibs, components, and templates
- ui.content: contains sample content using the components from the ui.apps
- ui.config: contains runmode specific OSGi configs for the project
- ui.frontend: an optional dedicated front-end build mechanism (Angular, React or general Webpack project)
- ui.tests: Selenium based UI tests
- all: a single content package that embeds all of the compiled modules (bundles and content packages) including any vendor dependencies
- analyse: this module runs analysis on the project which provides additional validation for deploying into AEMaaCS
To build all the modules run in the project root directory the following command with Maven 3:
mvn clean install
To build all the modules and deploy the all
package to a local instance of AEM, run in the project root directory the following command:
mvn clean install -PautoInstallSinglePackage
Or to deploy it to a publish instance, run
mvn clean install -PautoInstallSinglePackagePublish
Or alternatively
mvn clean install -PautoInstallSinglePackage -Daem.port=4503
Or to deploy only the bundle to the author, run
mvn clean install -PautoInstallBundle
Or to deploy only a single content package, run in the sub-module directory (i.e ui.apps
)
mvn clean install -PautoInstallPackage