Expand my Community achievements bar.

SOLVED

Maven clean install both Author & Publish

Avatar

Level 4

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?

1 Accepted Solution

Avatar

Correct answer by
Level 4

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

View solution in original post

1 Reply

Avatar

Correct answer by
Level 4

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