Highlighted

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

GK-AEM

19-03-2019

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>

Replies

Highlighted

Gaurav-Behl

MVP

19-03-2019

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.

Highlighted

GK-AEM

19-03-2019

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

Highlighted

Arun_Patidar

MVP

19-03-2019

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

Highlighted

GK-AEM

19-03-2019

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.

Highlighted

Arun_Patidar

MVP

19-03-2019

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>

Highlighted

GK-AEM

19-03-2019

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?

Highlighted

Prince_Shivhare

19-03-2019

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

Highlighted

Arun_Patidar

MVP

20-03-2019

Hi,

Changes require in parent POM only.

I ran below command from Eclipse.

mvn clean install -P autoInstallpackagePublish