muntakim360
muntakim360

Reputation: 97

AEM - Continous Integration with Maven

I am very new in AEM and Maven too and I want to implement CI for my AEM website.

Below is the flow that'd like to implement in Go.CD or Jenkins where I've figured out how to do the first 3 stages.

I am now struggling with no.4 and no.5 (same as no.4).

I'd like to do mvn clean install -PautoInstallPackage with the artifact uploaded to nexus repository but not installing the current code.

Please see the comments beside the stages below

      +-----------+
(1)   |    GIT    |   Start the pipe line when
      +-----+-----+   code is committed.
            |
            v
      +-----+-----+
(2)   | UNIT TEST |    Run the *mvn test*
      +-----+-----+
            |
            v
      +-----+-----+    Run the *mvn clean deploy*
(3)   |   DEPLOY  |    And this uploads the artifacts
      +-----+-----+    to a private nexus repository
            |
            v
      +-----+-----+    Install the artifact compiled, jar'ed
(4)   | INSTALL TO|    and uploaded to nexus repository in stage 3
      |   QA ENV  |    when manually triggered.
      +-----+-----+
            |
            v
      +-----+-----+    Install the same artifact from the
(5)   | INSTALL TO|    current pipeline compiled in 
      |  STAGING  |    stage 3 to staging when manually
      +-----------+    triggered.

Your help is highly appreciated.

Upvotes: 2

Views: 1590

Answers (2)

Abhishek
Abhishek

Reputation: 1190

Steps 4 and 5 are outside the maven build/deploy phases. These are more related to code promotion processes across environments which can vary from one org to another.

Since you're working with AEM, there are options to use curl to deploy artifacts (AEM packages or OSGI bundles) to the server. Many commonly used curl commands can be found here

You can create scripts which can upload/install/uninstall your artifacts to AEM. The input to the scripts can be your intended server environment and artifact name/version. Jenkins job can then trigger those scripts providing the required input to scripts from Jenkins controlled variables.

e.g. curl -u username:password -F file=@"name of zip file" -F name="name of package" -F force=true -F install=true http://localhost:4503/crx/packmgr/service.jsp.
This is the crux of package install shell script. Username, password, AEM server URL package zip can all be variables which can be passed down from Jenkins when the job triggers the execution of this script.

If your packages are in local nexus repo, you can download the package before installing to AEM with this script.

Upvotes: 4

Emin Can Sümer
Emin Can Sümer

Reputation: 523

You can use the Vault maven plugin to deploy your artifacts. It resides in the http://repo.adobe.com. Sample usage of plugin is:

<plugin>
    <groupId>com.day.jcr.vault</groupId>
    <artifactId>content-package-maven-plugin</artifactId>
    <version>0.0.23</version>
    <extensions>true</extensions>
    <configuration>
        <failOnError>true</failOnError>
        <userId>${aem.user}</userId>
        <password>${aem.password}</password>
    </configuration>
</plugin>

You should add adobe repository to your maven POM as well:

<repository>
    <id>adobe-public-releases</id>
    <name>Adobe Basel Public Repository</name>
    <url>http://repo.adobe.com/nexus/content/groups/public</url>
    <releases>
        <enabled>true</enabled>
        <updatePolicy>never</updatePolicy>
    </releases>
    <snapshots>
        <enabled>false</enabled>
    </snapshots>
</repository>

You can check the official documentation about it https://docs.adobe.com/docs/en/aem/6-0/develop/dev-tools/vlt-mavenplugin.html

Upvotes: 0

Related Questions