mvn clean install -PautoInstallPackage | Community
Skip to main content
PranavJoshi
May 24, 2024
Solved

mvn clean install -PautoInstallPackage

  • May 24, 2024
  • 4 replies
  • 3273 views

Does "mvn clean install -PautoInstallPackage" installs both package and bundle. If not, can I deploy both package and bundle in single command?

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 sravs

Hi @pranavjoshi , please refer the various commands to deploy either bundle or package, or both at time in below document

 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/maven-commands-for-aem-aem-community-blog-seeding/m-p/388627

4 replies

AMANATH_ULLAH
Community Advisor
Community Advisor
May 24, 2024

@pranavjoshi 

Yes "mvn clean install -PautoInstallPackage" command installs both package and bundle 

Amanath Ullah
Jagadeesh_Prakash
Community Advisor
Community Advisor
May 24, 2024

@pranavjoshi  Ideally mvn  -PautoInstallPackage clean install should work. If not try below command 

 

mvn  -PautoInstallPackage -PautoInstallBundle clean install 

sravs
Community Advisor
sravsCommunity AdvisorAccepted solution
Community Advisor
May 24, 2024

Hi @pranavjoshi , please refer the various commands to deploy either bundle or package, or both at time in below document

 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/maven-commands-for-aem-aem-community-blog-seeding/m-p/388627

HrishikeshKagne
Community Advisor
Community Advisor
May 25, 2024

Hi @pranavjoshi ,

The command mvn clean install -PautoInstallPackage typically builds and installs the AEM package defined in your Maven project into the AEM instance. However, it does not directly handle the deployment of OSGi bundles.

To deploy both an AEM package and OSGi bundles in a single command, you would typically use a tool like Apache Felix File Install, Apache Sling Installer, or Apache Karaf, which can monitor a folder for changes and automatically deploy bundles placed in that folder.

However, if you want to automate the deployment of both the AEM package and OSGi bundles through Maven, you can achieve this by configuring Maven to execute additional deployment steps after installing the package.

Here's a rough example of how you might extend your Maven build to deploy both the package and bundles:

 

<project> ... <build> ... <plugins> ... <!-- Maven Sling Plugin to deploy bundles --> <plugin> <groupId>org.apache.sling</groupId> <artifactId>maven-sling-plugin</artifactId> <version>${maven.sling.plugin.version}</version> <executions> <execution> <id>install-bundles</id> <goals> <goal>install</goal> </goals> <configuration> <bundles> <!-- Define your OSGi bundles to deploy --> <bundle> <artifactId>your-bundle-artifact-id</artifactId> <groupId>your-bundle-group-id</groupId> <version>your-bundle-version</version> <!-- Optionally, specify start-level, start, and fragment attributes --> </bundle> <!-- Add more bundle elements for additional bundles --> </bundles> <startBundles>true</startBundles> </configuration> </execution> </executions> </plugin> ... </plugins> </build> </project>

 

With this configuration, when you run mvn clean install -PautoInstallPackage, Maven will first build and install the AEM package. Then, it will execute the install-bundles execution of the Maven Sling Plugin, which will deploy the specified OSGi bundles to the AEM instance.

Please note that you need to replace your-bundle-artifact-id, your-bundle-group-id, and your-bundle-version with the actual artifact ID, group ID, and version of your OSGi bundles.

This approach allows you to automate the deployment of both AEM packages and OSGi bundles with a single Maven command.

Hrishikesh Kagane