Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

How to deploy code(ui,content,core) packages to multiple publish instances using content maven plugin?

Avatar

Level 9

Hi All,

I am using content maven plugin(content-package-maven-plugin) to deploy code to pre-prod environment.i could able to deploy code without an issue if there is one author and one publish. One of the pre-prod environment has 1 author and 2 publish instances, here I am facing an issue that I could able to deploy code to one publish instance and not to another one.i have also created a separate profile with another id(e.g. autoInstallpackagePublish2) still i code is not deploying to other publish instance.

Is anyone done come across similar requirement and implemented the same. Please help me,i have spent lot of time but could not find any way to achieve this,

My project is created using Archtype-13.

<profile>

<id>autoInstallPackagePublish</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-publish</id>

                              <goals>

                                        <goal>install</goal>

                             </goals>

                    <configuration>

                                 <targetURL>http://publishaemqa1.xxxxx.com:80/crx/packmgr/service.jsp</targetURL>

                    </configuration>

                    </execution>

               <execution>

                    <id>install-package-publish2</id>

                             <goals>

                              <goal>install</goal>

                              </goals>

                    <configuration>

                             <targetURL>http://publishaemqa2.xxxxx.com:80/crx/packmgr/service.jsp</targetURL>

                    </configuration>

          </execution>

          </executions>

</plugin>

</plugins>

</pluginManagement>

</build>

</profile>

9 Replies

Avatar

Level 10

You'd need to invoke these profiles individually from CI/CD tool jenkins/bamboo or similar. Configure multiple build-targets in that job and pick a different profile for each target.

Avatar

Level 9

I have created a separate profile and executed as part of Maven task in Bamboo but still, the code is not installing to other publish instance.

"mvn clean -PautoInstallPackage,autoInstallPackagePublish,autoInstallPackagePublish2 install" and supplied required author and publish instance details via variables.

i would be great if you have any sample piece of configuration for the same.

Thanks,

Kishore

Avatar

Community Advisor

Hi,

Your POM looks ok though, what happened if you change the sequence of publishers execution tag. Is It deploying on 2nd one or still on 1st?

if you are deploying package on another publisher using new profile the you need to call .

mvn clean install -P autoInstallpackagePublish, autoInstallpackagePublish2

Check below if helps

https://www.albinsblog.com/2015/06/deploying-bundlespackages-to-different-env-maven-adobecq5-adobeae...



Arun Patidar

Avatar

Level 9

I have changed the execution sequence but still, it's picking the 1st one. I doubt id which we mentioned for other publish instance is not valid one so even though there is no syntax error but still it's not considering.

Thanks for Sharing the article, the article talks about if there is one author and publish instance ad i have asked a question to the author what could be the way in case of more than one publish instance.

Avatar

Level 10

If you want to proceed with this approach, then try -P "profile1,profile2" within quotes

Avatar

Community Advisor

I tried same in my machine,I am able to deploy on both the servers.

when I change the sequence it start picking another one. I tested project using archetype 11 and 13

Are you sure you are changing correct POM? Can you share your maven deployment logs.

<profile>

   <id>autoInstallPackagePublish</id>

   <activation>

      <activeByDefault>false</activeByDefault>

   </activation>

   <build>

      <pluginManagement>

         <plugins>

            <plugin>

               <groupId>com.day.jcr.vault</groupId>

               <artifactId>content-package-maven-plugin</artifactId>

               <executions>

                  <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>

                  <execution>

                     <id>install-package-publish2</id>

                     <goals>

                        <goal>install</goal>

                     </goals>

                     <configuration>

                        <targetURL>http://${aem.publish.host}:4505/crx/packmgr/service.jsp</targetURL>

                     </configuration>

                  </execution>

               </executions>

            </plugin>

         </plugins>

      </pluginManagement>

   </build>

</profile>



Arun Patidar

Avatar

Level 9

I am changing in the parent pom only.Do we require to do any more changes to other POMs?

Can you please share the Maven command which you used to build and deploy the code?

Avatar

Community Advisor

No, that should be in parent pom only.

and command depends on your profile Id in pom file.

in your case, it should be mvn clean install -PautoInstallPackagePublish

Avatar

Community Advisor

Hi,

Changes require in parent POM only.

I ran below command from Eclipse.

mvn clean install -P autoInstallpackagePublish



Arun Patidar