For rapid AEM backend developer, we would like to build the AEM core module bundle to our running local AEM instance. In this article, we will configure the core bundle with an automated script. Simple build the project with mvn clean install -PautoInstallBundle. This is actually a standard that is shipped from the aem-project-archetype-39, but not configured to the AEM core module.
At the creation of this article, I have used https://github.com/adobe/aem-project-archetype/tree/aem-project-archetype-39.
1. Add a new profile in your core/pom.xml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | <profiles> <profile> <id>autoInstallBundle</id> <activation> <activeByDefault>false</activeByDefault> </activation> <build> <pluginManagement> <plugins> <plugin> <groupId>org.apache.sling</groupId> <artifactId>sling-maven-plugin</artifactId> <version>2.4.0</version> <executions> <execution> <id>install-bundle</id> <goals> <goal>install</goal> </goals> <configuration> <slingUrl>${aem.host}:${aem.port}/system/console</slingUrl> </configuration> </execution> </executions> </plugin> </plugins> </pluginManagement> </build> </profile> </profiles> |
2. Change directory to the core bundle folder, and then run the command below:
1 2 3 | cd ~/git/2023/sourcedcode/core mvn clean install -PautoInstallBundle |
3. What’s the difference between Maven plugins vs dependencies?
Plugins are used during the code build phase, when code is being built by Maven; plugins are where much of the real action is performed, plugins are used to: create jar files, create war files, compile code, unit test code, create project documentation, and on and on. Almost any action that you can think of performing on a project is implemented as a Maven plugin.
Dependencies are declared and used by Maven. During the build, Maven will download the dependencies to your local repository and then use this to compile your JAR. We use the <scope&;gt;test/<scope&;gt;t to indicate that dependency is not required at the runtime of the application but is used only for test purposes; this dependency will not be bundled with the .jar producted.