AEMaaCS Multiple Projects issue | Community
Skip to main content
Sean-McK
New Participant
April 13, 2023
Solved

AEMaaCS Multiple Projects issue

  • April 13, 2023
  • 2 replies
  • 718 views

Hey All,

 

I have a unique issue. Let me give you an example:

 

Parent Pom:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.company.aem</groupId>
  <artifactId>company-reactor</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>pom</packaging>
  <modules>
    <module>dispatcher</module>
    <module>global</module>
    <module>company</module>
  </modules>
</project>
 
Global is just a package and references both Core and Cif. Now the company pom needs to reference global package, the problem is I get:
[api-regions-exportsimports] com.company:company.core:1.0.0-SNAPSHOT: Bundle company.core:1.0.0-SNAPSHOT is importing package(s) [com.company.aem.global.core.util, com.company.aem.global.core.util.path, com.company.aem.global.core.models] in start level 20 but no bundle is exporting these for that start level. (com.company:company.all:1.0.0-SNAPSHOT)
 
They don't have a public Maven Repo and I am trying to implement https://myaemlearnings.blogspot.com/2021/08/embedding-third-party-dependencyosgi.html but I don't know how to reference a module outside the company project. 
 
Any help?
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by nitesh_kumar-1

Hi @sean-mck ,

 

If they don't have a Nexus repo, you can take the following approach.

  • Make the project as a submodule of this parent project either by adding the whole module or using the git submodule, this way the dependencies will be built and shipped with the deployment.
  • As a workaround, You can commit that package in a separate folder of your project and then include that into your container project by referencing the path, something like this

First embed into the section of the container POM

 

 

<embedded> <groupId>groupID</groupId> <artifactId>artifactId</artifactId> <type>zip</type> <target>/apps/vendorpackage/application/install</target> </embedded>

 

 

 

and then add it to the dependency section of the same container POM

 

 

<dependency> <groupId>groupID</groupId> <artifactId>artifactId</artifactId> <type>type</type> <scope>system</scope> <systemPath>/${basedir}/../packages/project-${version}.zip</systemPath> </dependency>

 

 

 

This would ensure the deployment of these packages to the instances. So you won't get the validation error.

 

Also, include this as a dependency in parent POM and the modules where you need it so that compilation works as well.

 

Note: This is not a future-proof solution and might give you some errors in the future if something changes on the cloud manager, the recommended approach would be to either work through gitsubmodules or maven repo. (private maven repos are also supported on cloud manager).

 

Hope this helps!

 

Regards,

Nitesh

 

2 replies

nitesh_kumar-1
nitesh_kumar-1Accepted solution
Employee
April 14, 2023

Hi @sean-mck ,

 

If they don't have a Nexus repo, you can take the following approach.

  • Make the project as a submodule of this parent project either by adding the whole module or using the git submodule, this way the dependencies will be built and shipped with the deployment.
  • As a workaround, You can commit that package in a separate folder of your project and then include that into your container project by referencing the path, something like this

First embed into the section of the container POM

 

 

<embedded> <groupId>groupID</groupId> <artifactId>artifactId</artifactId> <type>zip</type> <target>/apps/vendorpackage/application/install</target> </embedded>

 

 

 

and then add it to the dependency section of the same container POM

 

 

<dependency> <groupId>groupID</groupId> <artifactId>artifactId</artifactId> <type>type</type> <scope>system</scope> <systemPath>/${basedir}/../packages/project-${version}.zip</systemPath> </dependency>

 

 

 

This would ensure the deployment of these packages to the instances. So you won't get the validation error.

 

Also, include this as a dependency in parent POM and the modules where you need it so that compilation works as well.

 

Note: This is not a future-proof solution and might give you some errors in the future if something changes on the cloud manager, the recommended approach would be to either work through gitsubmodules or maven repo. (private maven repos are also supported on cloud manager).

 

Hope this helps!

 

Regards,

Nitesh

 

Saravanan_Dharmaraj
New Participant
April 13, 2023

@sean-mck If you have jar from that third party, you can embed into the bundle

 

Please check this out.

https://aemsimplifiedbynikhil.wordpress.com/2020/08/23/resolve-dependencies-by-converting-jar-to-bundle-aem-6-5-5/