Expand my Community achievements bar.

SOLVED

Install bundle via container pkg maven

Avatar

Level 4

Hello Community - I have a maven project which has only the core module and don't have any other modules(ui.apps, ui.content, ui.config,ui.all) in it. I'd like to create a bundle and encapsulate it in the package, so that when you install package which should install the bundle automatically. I can do this if I add a ui.app module to the project, but it's not required for me.

 

I've been trying to add a filevault plugin to the core module, but the package doesn't actually install the bundle. If you've already done a similarly requirement, can someone please let me know if this is the case and share more details to get it?

1 Accepted Solution

Avatar

Correct answer by
Level 10

@s1101v As part of all/pom.xml or root pom.xml update below code with required info to install bundle.

<plugins>
            <plugin>
                <groupId>org.apache.jackrabbit</groupId>
                <artifactId>filevault-package-maven-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <group>com.project</group>
                    <packageType>container</packageType>
                    <!-- skip sub package validation for now as some vendor packages like CIF apps will not pass -->
                    <skipSubPackageValidation>true</skipSubPackageValidation>
                    <embeddeds>
                        <embedded>
                            <groupId>com.project</groupId>
                            <artifactId>project.core</artifactId>
                            <target>/apps/foldername/application/install</target>
                        </embedded>
                    </embeddeds>
                </configuration>
            </plugin>
        </plugins>

 

Run below command to install code bundle under project code folder

mvn clean install -PautoInstallBundle -DskipTests=true

View solution in original post

6 Replies

Avatar

Level 10

@s1101v We can not do this way as jar always require to have one of the folder to hold or store our jar like /apps/practice/install/practice.jar

We will not be able to install without location. its kind of jar without location.

 

 

<plugin>
   <groupId>org.apache.sling</groupId>
   <artifactId>maven-sling-plugin</artifactId>
   <configuration>
      <slingUrl>${crx.host}/apps/practice/install</slingUrl>
      <usePut>true</usePut>
   </configuration>
</plugin>

 

Note: If you are already having some project available in crx/de. To verify in local, please perform a local build from core folder to install in specific path and remove ui.apps dependency.

mvn clean install -PautoInstallBundle

 

Location is must, not having above entry will give below error:

Imran__Khan_0-1708927219075.png

 

Avatar

Level 4

Thanks @Imran__Khan for your reply. I have another path/folder which is available in the instance as part of different aem project and moreover we cannot merge or move the bundle to other project. is it possible to leverage the location(different aem proj location) to store the jar from this aem project and perform the install ? If it's possible, please let me know what should be done to achieve this? Thank you.

Avatar

Correct answer by
Level 10

@s1101v As part of all/pom.xml or root pom.xml update below code with required info to install bundle.

<plugins>
            <plugin>
                <groupId>org.apache.jackrabbit</groupId>
                <artifactId>filevault-package-maven-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <group>com.project</group>
                    <packageType>container</packageType>
                    <!-- skip sub package validation for now as some vendor packages like CIF apps will not pass -->
                    <skipSubPackageValidation>true</skipSubPackageValidation>
                    <embeddeds>
                        <embedded>
                            <groupId>com.project</groupId>
                            <artifactId>project.core</artifactId>
                            <target>/apps/foldername/application/install</target>
                        </embedded>
                    </embeddeds>
                </configuration>
            </plugin>
        </plugins>

 

Run below command to install code bundle under project code folder

mvn clean install -PautoInstallBundle -DskipTests=true

Avatar

Community Advisor

Hi @s1101v ,

If your requirement is only to install core bundle on AEM and not any package then you can simple use below mvn command

mvn clean install -PautoInstallBundle

 

For installation of package that contains other module also apart from core like "ui.apps" you can use 

mvn clean install -PautoInstallPackage

 

Thanks
Tarun

Avatar

Level 6

Hi @s1101v 

You can achieve this by using filevault-package-maven-plugin. You need to add an all module and in its pom.xml, using filevault-package-maven-plugin, package your core bundle in all package.

I tried it in my local and it builds code successfully.

salamswapnil_0-1708970652975.png

salamswapnil_0-1708970854591.png

Attaching sample project here. It is created with archetype 47 for AEM Cloud.

 

Avatar

Administrator

@s1101v 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 Sahni