Create custom content package programmatically | Community
Skip to main content
ndresgarc
Level 2
February 13, 2025
Solved

Create custom content package programmatically

  • February 13, 2025
  • 3 replies
  • 976 views

I'm trying to integrate the Adobe Experience Manager project into a CI process.

We are working in Adobe Experience Manager Forms.

We only edit in this project the form structure and a Client lib JavaScript code.

I want to create a content package programmatically using a Maven command so I can integrate this process (which currently we are doing manually) into GitHub Actions.

 

We need to send this .zip file to another provider so they upload to Adobe Experience Manager instance.

We do not have any other way of deploying it.

 

What I want to achieve is to be able to generate the same .zip package that I generate in my local instance in Package Manager, but in Github Actions after a successful Pull Request.

 

So far, I've created a new profile in Maven with this config:

 

        <profile>
            <id>create-release-client-lib-package</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.jackrabbit</groupId>
                        <artifactId>filevault-package-maven-plugin</artifactId>
                        <version>1.3.6</version>
                        <executions>
                            <execution>
                                <id>create-package</id>
                                <goals>
                                    <goal>package</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <enableMetaInfFiltering>true</enableMetaInfFiltering>
                            <packageType>container</packageType>
                            <filterSource>${project.basedir}/filter.xml</filterSource>
                            <jcrRootSourceDirectory>${project.basedir}/ui.apps/src/main/content/jcr_root,${project.basedir}/ui.content/src/main/content/jcr_root</jcrRootSourceDirectory>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
 
The project contains a file named "filter.xml" in the root folder as this:
 

<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
    <filter root="/ui.apps/src/main/content/jcr_root/apps/gsit/ext/ClientLibFolder" mode="replace"/>
    <filter root="/ui.content/src/main/content/jcr_root/content/dam/formsanddocuments/mysite/folder"></filter>
    <filter root="/ui.content/src/main/content/jcr_root/content/forms/af/mysite/folder"></filter>
</workspaceFilter>
 
 
I'm getting the error:
 
java.io.FileNotFoundException: C:\Users\my-user\Projects\my-project\git\target\vault-work\META-INF\vault\filter.xml
 
Which I suppose that is not the original filter.xml file but the file that gets created later
by filevault-package-maven-plugin inside the target folder.
 
Any ideas on this?
Thanks in advance.
 
 
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 ndresgarc

Thanks @arunpatidar 

Thanks @manvisharma 

 

I tried your suggestions but didn't work.

 

I don't know how to check this:

Also check if prepare-package goals work
 <goal>prepare-package</goal>

 

I keep getting the same error.

 

I found there is this NPM project: https://www.npmjs.com/package/aem-packager

Which manages to create a package for a Clientlib,

somewhere using https://github.com/amclin/aem-packager/blob/master/aem-packager.js and https://github.com/amclin/aem-packager/blob/master/src/pom.xml
This tool is a wrapper for Maven, but I don't fully understand the Maven command that is using.

This creates the package and can be imported to AEM successfully, but differs in some files from the packages created in the Package Manager, although it does only for one folder.

But if I understood the process, I could replicate for multiple folders.

 

Thanks.

 

 

3 replies

arunpatidar
Community Advisor
Community Advisor
February 13, 2025

HI @ndresgarc 

You need to create the filter.xml file inside the /META-INF/vault/filter.xml

Example

https://github.com/arunpatidar02/aemaacs-aemlab/blob/master/ui.apps/src/main/content/META-INF/vault/filter.xml

 

Also the content of the filter.xml would be like

<?xml version="1.0" encoding="UTF-8"?> <workspaceFilter version="1.0"> <filter root="/apps/gsit/ext/ClientLibFolder" mode="replace"/> <filter root="/content/dam/formsanddocuments/mysite/folder"></filter> <filter root="/content/forms/af/mysite/folder"></filter> </workspaceFilter>

 

Also check if prepare-package goals work
 <goal>prepare-package</goal>

Arun Patidar
ManviSharma
Adobe Employee
Adobe Employee
February 17, 2025

Hi ,

The error java.io.FileNotFoundException: C:\Users\my-user\Projects\my-project\git\target\vault-work\META-INF\vault\filter.xml suggests that during the packaging process, the plugin is attempting to create or access a filter.xml file in the target/vault-work/META-INF/vault directory, but it doesn't exist. This file is crucial as it defines what parts of your JCR content structure should be included in the package.

Please check that the filter.xml file specified in your configuration is correctly placed and accessible. The path ${project.basedir}/filter.xml should be correct relative to your project structure.  

ndresgarc
ndresgarcAuthorAccepted solution
Level 2
February 17, 2025

Thanks @arunpatidar 

Thanks @manvisharma 

 

I tried your suggestions but didn't work.

 

I don't know how to check this:

Also check if prepare-package goals work
 <goal>prepare-package</goal>

 

I keep getting the same error.

 

I found there is this NPM project: https://www.npmjs.com/package/aem-packager

Which manages to create a package for a Clientlib,

somewhere using https://github.com/amclin/aem-packager/blob/master/aem-packager.js and https://github.com/amclin/aem-packager/blob/master/src/pom.xml
This tool is a wrapper for Maven, but I don't fully understand the Maven command that is using.

This creates the package and can be imported to AEM successfully, but differs in some files from the packages created in the Package Manager, although it does only for one folder.

But if I understood the process, I could replicate for multiple folders.

 

Thanks.