Expand my Community achievements bar.

SOLVED

AEMaaCS Multiple Projects issue

Avatar

Level 5

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?
1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

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

 

View solution in original post

2 Replies

Avatar

Correct answer by
Employee Advisor

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