In this article, we will learn how we can manage our AEM project deployment to an AEM instance
when you want to deploy your project to AEM instances in that case first we need to run "mvn clean install" command
what mvn clean install do?
The bottom image is showing only for all folders. when you will run the mvn clean command you will find .zip file under ui.apps ui.content etc.
It means mvn clean install will create the build of all folders separately and will save the build in the same folder under target.
but it will create the .jar file under the core because its a bundle, not a package
after creating we need to deploy the packages to the AEM instance. Now we need to specify in which instance we want to deploy packages
Here are multiple ways to upload the packages to the AEM instance
- via profiles
- via cURL
- manually upload
Deploy Packages via a profile on Author
if you will go to your root pom file here you will find a profile with the id "autoInstallPackage"
this profile is only about deploying the packages to the AEM author instance. To run this profile you need to run the following command
this profile is only about deploying the packages to the AEM author instance. To run this profile you need to run the following command
- mvn clean install -PautoInstallPackage
Deploy Packages via a profile on Publish
if you will go to your root pom file here you will find a profile with the id "autoInstallPackagePublish"
this profile is only about deploying the packages to the AEM publish instance. To run this profile you need to run the following command
this profile is only about deploying the packages to the AEM publish instance. To run this profile you need to run the following command
- mvn clean install -PautoInstallPackagePublish
How we can deploy packages with one command on Both Instances?
By default, there is no profile in the pom file to deploy the packages to both AEM instances with one command, but here you can create your own profile by putting another profile under one profile
in the bellow code creating a new profile "autoInstallPackageDeploy" and inside this profile, I copied and pasted the profile " autoInsallPackage" that was related to deploying packages on the author instance.
and same for publish instance I copied and pasted the profile " autoInsallPackagePublish" which was related to deploying packages on the publish instance.
in the bellow code creating a new profile "autoInstallPackageDeploy" and inside this profile, I copied and pasted the profile " autoInsallPackage" that was related to deploying packages on the author instance.
and same for publish instance I copied and pasted the profile " autoInsallPackagePublish" which was related to deploying packages on the publish instance.
<profile>
<id>autoInstallPackageDeploy</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</id>
<goals>
<goal>install</goal>
</goals>
<configuration>
<targetURL>http://${aem.host}:${aem.port}/
crx/packmgr/service.jsp
</targetURL>
</configuration>
</execution>
</executions>
</plugin>
<!-- publish -->
<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://${aem.publish.host}
:${aem.publish.port}/crx/packmgr/
service.jsp
</targetURL>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
now if you will run mvn clean install with the newly created profile the Packages will be auto-deploy on both instances
- mvn clean install -PautoInstallPackageDeploy
How to deploy Packages manually?
goto http://localhost:4502/crx/packmgr/index.jsp
and follow the bottom image next.
goto http://localhost:4502/crx/packmgr/index.jsp
and follow the bottom image next.
after successful uploading, by clicking on the Install button you can install your package.
0 comments: