Maven clean install both Author & Publish | Community
Skip to main content
Level 3
August 22, 2024
Solved

Maven clean install both Author & Publish

  • August 22, 2024
  • 1 reply
  • 606 views

Can you install your package on both Author and Publish with a single Maven command so you do not need to compile the package (and run unit tests) twice?

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 jeremylanssiers

I found you can easily add a profile to maven to achieve it:

<profile> <id>autoInstallPackageAuthorAndPublish</id> <activation> <activeByDefault>false</activeByDefault> </activation> <build> <pluginManagement> <plugins> <plugin> <groupId>org.apache.jackrabbit</groupId> <artifactId>filevault-package-maven-plugin</artifactId> <executions> <execution> <id>create-package</id> <goals> <goal>package</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>com.day.jcr.vault</groupId> <artifactId>content-package-maven-plugin</artifactId> <executions> <execution> <id>install-package-author</id> <goals> <goal>install</goal> </goals> <configuration> <targetURL>http://${aem.host}:${aem.port}/crx/packmgr/service.jsp</targetURL> </configuration> </execution> <execution> <id>install-package-publish</id> <goals> <goal>install</goal> </goals> <configuration> <targetURL> http://${aem.publish.host}:${aem.publish.port}/crx/packmgr/service.jsp </targetURL> </configuration> </execution> </executions> </plugin> </plugins> </pluginManagement> </build> </profile>


Now use the following command:

mvn -s /path/to/settings.xml clean install -PautoInstallPackageAuthorAndPublish -Padobe-public

1 reply

jeremylanssiersAuthorAccepted solution
Level 3
August 22, 2024

I found you can easily add a profile to maven to achieve it:

<profile> <id>autoInstallPackageAuthorAndPublish</id> <activation> <activeByDefault>false</activeByDefault> </activation> <build> <pluginManagement> <plugins> <plugin> <groupId>org.apache.jackrabbit</groupId> <artifactId>filevault-package-maven-plugin</artifactId> <executions> <execution> <id>create-package</id> <goals> <goal>package</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>com.day.jcr.vault</groupId> <artifactId>content-package-maven-plugin</artifactId> <executions> <execution> <id>install-package-author</id> <goals> <goal>install</goal> </goals> <configuration> <targetURL>http://${aem.host}:${aem.port}/crx/packmgr/service.jsp</targetURL> </configuration> </execution> <execution> <id>install-package-publish</id> <goals> <goal>install</goal> </goals> <configuration> <targetURL> http://${aem.publish.host}:${aem.publish.port}/crx/packmgr/service.jsp </targetURL> </configuration> </execution> </executions> </plugin> </plugins> </pluginManagement> </build> </profile>


Now use the following command:

mvn -s /path/to/settings.xml clean install -PautoInstallPackageAuthorAndPublish -Padobe-public