AEM build integration with JFrog Artifactory

Bibin Sabu
3 min readDec 29, 2016

Creating AEM builds with maven is pretty simple and straightforward. Once you have setup the AEM project, you can build it using Apache maven as described here : How to Build AEM Projects using Apache Maven

# installing on AEM instance

$ mvn -PautoInstallPackage install

But how will you manage your AEM builds? How will you revert to an old build in case of any build failure? Where will you store your builds? There comes the need of repository manager such as Sonatype Nexus, JFrog Artifactory, or Apache Archiva. Here I will describe how to integrate AEM builds (bundles-jar and packages-zip) with JFrog Artifactory.

Now lets see AEM build integration in Artifactory using :

  1. Jenkins plugin
  2. Curl command.

Using Jenkins Plugin

Once you have Jenkins installed and setup, download Artifactory Plugin from Jenkins update center and configure it.

Next, setup a maven job in Jenkins for executing the AEM maven project.

Once the build section in completed in Jenkins job, go to Post-build Actions and select ‘ Deploy artifacts to Artifactory ’.

Give your Artifactory server url, target release and snapshot repository as shown below:

Check ‘Deploy maven artifacts’ and add patterns to include or exclude files that should be added to artifactory repository. Here I have included only jar and zip files. So when a maven build is executed, only AEM bundle(.jar) and package(.zip) file will be considered for deployment.

Keep all other parameters as default. When a new build is created , AEM builds bundles will be uploaded to artifactory repository as shown below.

Artifactory Plugin will take care of uploading bundles (with the parameters configured in Jenkins) to Artifactory repository with zero coding effort.

Using Curl Command

AEM builds can be uploaded to Artifactory using command line as well. Once the AEM builds are created using maven, the bundles can be uploaded to the artifactory repository using CURL command.

The following command demonstrates how to do it :

curl -u {user}:{password} -X PUT "http://{ip}:{port}/artifactory/{repository-path}" -T {file-location}Eg:curl -u admin:p@ssw0rd -X PUT "http://x.x.x.x:8081/artifactory/libs-release-local/com/aem.core/" -T /tmp/aem/aem.core-1.0.1.20161031.jar

where:

{ip} - ip address of artifactory server

{port} - port in which artifactory is running (default port is 8081)

{repository-path} - path in which bundle should be stored in artifactory server

{file-location} - bundle file location path

The above command will deploy the bundle aem.core-1.0.1.20161031.jar bundle to libs-release-local/com/aem.core/ repository directory in Artifactory.

So, integrating AEM builds with Jfrog Artifactory repository is simple and can be implemented easily with Jenkins Artifactory plugin or using curl command. Once the builds are uploaded in Artifactory , they can be easily managed and deployed to any other servers whenever required.

--

--