Deploying Core Module of the AEM Project

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.


Looking for Help? Or need a mentor?

If you need help to super drive your AEM career road map, you can hire me for a one-hour session on codementor.io; We can work together on a price works just for you. https://www.codementor.io/@briankasingli. I'd be happy to help you along your way to becoming a high-quality AEM full-stack engineer.

Was this post helpful?

Hello, I am an enthusiastic Adobe Community Advisor and a seasoned Lead AEM Developer. I am currently serving as an AEM Technical Lead at MNPDigital.ca, bringing over a decade of extensive web engineering experience and more than eight years of practical AEM experience to the table. My goal is to give back to the AEM Full Stack Development community by sharing my wealth of knowledge with others. You can connect with me on LinkedIn.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top