We are exploring on using Adobe Cloud Manager for our daily build but we have 1 jar which is not exist in public so we need to manually add to build.
I have added jar in code base and reference in pom.xml as below but still build is getting failed.
<dependency>
<groupId>com.aem</groupId>
<artifactId>aem-bundle</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${project.basedir}/../local/aem-bundle-1.0-SNAPSHOT.jar</systemPath>
</dependency>
We have follow the below link and created local repo and pushed the jar in local repo inside code base and tried to refer the jar inside code but still it didn't work.
Reference - https://techrevelhub.wordpress.com/2023/09/27/managing-third-party-dependencies-in-aem/
Error:
Could not resolve dependencies for project com.cms:cms.core:jar:1.0-SNAPSHOT: Could not find artifact com.aem:aem-bundle:jar:1.0-SNAPSHOT in project.local (file:/build_root/build/cms/core/../local) -> [Help 1]
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hi Murali,
Firstly, the use of the system scope and systemPath elements in your Maven POM file is not recommended and generally not supported in Cloud Manager. This approach is intended for dependencies that are part of the JDK or the VM and hence is not suitable for third-party libraries which should be managed through a repository.
According to Adobe's documentation, all third-party packages must be available via Adobe’s public Maven artifact repository or an accessible public, third-party Maven artifact repository. If the packages are not in Adobe’s repository, and they are in a public repository, that repository must be registered in your project’s pom.xml. If storing the package in a remote repository is not possible, Adobe recommends placing it in a local, file-system-based Maven repository, which is committed to the source control management (SCM) as part of the project.
Here's a broad breakdown of the steps you should follow based on the information:
Here is an example snippet provided by Adobe for declaring a local repository in your pom.xml:
<repository> <id>project.local</id> <name>project</name> <url>file:${project.basedir}/local-repo</url> </repository>
And then, you should reference your dependency like this:
<dependency> <groupId>com.aem</groupId> <artifactId>aem-bundle</artifactId> <version>1.0-SNAPSHOT</version> </dependency>
For this to work, you must place your JAR in the correct location within the local repository structure that Maven expects, which mirrors the group and version structure of the repository's URL.
Adobe provides detailed documentation on how to include and manage third-party dependencies. Following these guidelines should help resolve the build issues you are experiencing with Cloud Manager.
Hi @Muralihb
You are facing this issue in your local build or cloud manager build ?
Also can you please confirm if you have made the suggested changes in all/pom.xml as well - https://github.com/aanchalsikka/techrevelaemsite/pull/3/files
Thanks
Narendra
Hi Narendra,
Thank you for quick reply. Our local build is successful on both the case.
We are facing issue on cloud manager only.
Main pom.xml is able to fetch the jar from local repo but it was failing on core/pom.xml
21:46:57,735 [main] [INFO] Downloading from project.local: file:/build_root/build/cms/core/../local/com/aem/aem-bundle/1.0-SNAPSHOT/aem-bundle-1.0-SNAPSHOT.pom
21:46:58,016 [main] [INFO] Downloading from project.local: file:/build_root/build/cms/core/../local/com/aem/aem-bundle/1.0-SNAPSHOT/aem-bundle-1.0-SNAPSHOT.jar
Hi Murali,
Firstly, the use of the system scope and systemPath elements in your Maven POM file is not recommended and generally not supported in Cloud Manager. This approach is intended for dependencies that are part of the JDK or the VM and hence is not suitable for third-party libraries which should be managed through a repository.
According to Adobe's documentation, all third-party packages must be available via Adobe’s public Maven artifact repository or an accessible public, third-party Maven artifact repository. If the packages are not in Adobe’s repository, and they are in a public repository, that repository must be registered in your project’s pom.xml. If storing the package in a remote repository is not possible, Adobe recommends placing it in a local, file-system-based Maven repository, which is committed to the source control management (SCM) as part of the project.
Here's a broad breakdown of the steps you should follow based on the information:
Here is an example snippet provided by Adobe for declaring a local repository in your pom.xml:
<repository> <id>project.local</id> <name>project</name> <url>file:${project.basedir}/local-repo</url> </repository>
And then, you should reference your dependency like this:
<dependency> <groupId>com.aem</groupId> <artifactId>aem-bundle</artifactId> <version>1.0-SNAPSHOT</version> </dependency>
For this to work, you must place your JAR in the correct location within the local repository structure that Maven expects, which mirrors the group and version structure of the repository's URL.
Adobe provides detailed documentation on how to include and manage third-party dependencies. Following these guidelines should help resolve the build issues you are experiencing with Cloud Manager.
@Muralihb Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.
@kautuk_sahniYes, i'm able to resolve this issue.
I have used local repo and imported the third party jar files.
Only change, we need to point the url to correct local-repo as below.
<repository> <id>project.local</id> <name>project</name> <url>file:${project.basedir}/../local-repo</url> </repository>
Views
Likes
Replies