Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Subpackage Merge for content-package-maven-plugin

Avatar

Level 2

We are currently adding a package (acs-commons in this case) to our Maven project as a subpackage. We need that subpackage to "merge" instead of "replace" since subpackages get installed after the project package. This is our configuration for the content-package-maven-plugin:

 

<plugin> <groupId>com.day.jcr.vault</groupId> <artifactId>content-package-maven-plugin</artifactId> <extensions>true</extensions> <configuration> <filterSource>${basedir}/META-INF/vault/filter.xml</filterSource> <verbose>true</verbose> <failOnError>true</failOnError> <group>HealthNow</group> <embeddeds> <!-- From project/core module --> <embedded> <groupId>this.is.our.group</groupId> <artifactId>core</artifactId> <target>/apps/myproject/install</target> </embedded> <!-- Scripting console for Felix --> <embedded> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.scripting.console</artifactId> <target>/apps/myproject/install</target> </embedded> </embeddeds> <subPackages> <subPackage> <groupId>com.adobe.acs</groupId> <artifactId>acs-aem-commons-content</artifactId> <filter>true</filter> </subPackage> </subPackages> </configuration> </plugin>

 

I can't find any documentation about most of the configuration options. The documentation on the content-package-maven-plugin only provides you with the configuration options for each goal, but not how to use them. Within the <subpackage> configuration, is there a way to "merge" that package instead of the default "replace?" Or will the subpackage's own filter file ALWAYS dictate the behavior?

5 Replies

Avatar

Community Advisor

Dear Dscirto,

You may try to modify your filter.xml config to include following line:

<filter root="/my/custom/path/to/merge" mode="merge"/>

As this woukd hint to package manager you want to merge instead of replace.

Hope this helps,

Regards,

Peter

Avatar

Level 2

Thanks for the reply.

Unfortunately, modifying the project's filter.xml file won't work. The subpackage gets installed after the main project's package. So if I have:

main-project-package

  • <filter root="/my/custom/path/to/merge" mode="merge" />

sub-package-from-external-repository

  • <filter root="/my/custom/path/to/merge" />

The main-project-package will perform its merge on "/my/custom/path/to/merge" as expected. Then sub-package-from-external-repository will install, using its own internal filter.xml. If that filter.xml is using a "replace" or "update" behavior (which it is), it will make the "merge" from main-project-package obsolete.

So what I need, really, is to know if there is a way to externally control the filter.xml behavior of a subpackage or specify a filter.xml for the subpackage to use.

Avatar

Level 1

dscirto​ Any luck with this?  I am in same conundrum for including  aem-core-wcm-components​ package in my project.

Avatar

Employee

Adding here so that it's helpful for someone else. We had the same issue for a project. What we did is as follows:

1. Added the ACS commons dependency to the ui.content package

2. Moved ui.content module above ui.apps in main pom.xml

3. Added customizations of ACS commons components to ui.apps module

Avatar

Employee Advisor

You can replace the content-package-maven-plugin with the filevault-maven-plugin [1], it's a more-or-less 1:1 replacement, it just cannot install the package into AEM. For the details how to combine both plugins see [2].

To your question: What you mean with "merge instead of replace"? It should not install if the package remains unchanged?

Jörg

[1] Jackrabbit Filevault Package Maven Plugin - Introduction

[2] aem-project-archetype/pom.xml at master · adobe/aem-project-archetype · GitHub