Monday 26 August 2019

Locally compile 3rd party bundles which are not available in public repository.

Some times I have seen, we may need some of the bundles latest version which are available in AEM but same version is not available in maven public repository or Adobe nexus repository. Here we will see how to get the bundle locally and compile it.

First Step -
if the third party bundle is in your local AEM server,

Getting bundle from AEM and install it in our local maven repository-

When you notice a bundle is available in AEM servers system >console >bundle, the AEM installed folder will have the same bundle in disk.

First of all you identify the bundle id from AEM system console as shown below.

Click on image to see it big

To find the same bundle in local disk, go to
AEM Installed folder\crx-quickstart\launchpad\felix\bundle<id>)

Click on image to see it big

Now copy this bundle to a location (for e.g C:)

Second Step: Next step is installing it in our local maven repository. Open the command prompt in c:

The syntax for installing the bundle in local repository is
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>

Actual command used:
mvn install:install-file -Dfile=bundle.jar -DgroupId=org.apache.jackrabbit -DartifactId=jackrabbit-api -Dversion=2.18.0 -Dpackaging=jar

Now you will have the dependency bundle in your local maven repsotory and your code will compile without issues.