Abstract
What is Maven: Maven is an automation tool used to build and deploy the code for java applications. All the maven commands are supposed to be run in the command prompt (of course )
How to check your maven version:
To run all the below mentioned commands, you need to have maven installed in your system (Pre-requisite 🤦 ). To check the version of your maven,
“mvn -v”
AEM and Maven:
In AEM maven is used to clean, build and install the code into different AEM instances. In this blog we will see various useful maven commands.
Cleaning the target directory code:
mvn clean
Cleaning and installing the code to a local repository:
mvn clean install
Note:
Generic maven commands are part of Maven life cycle [Ex: install]. They usually does not install your code in AEM. We need to use specific Maven plug-ins to achieve that.
Installing package (including bundle) into AEM instance:
mvn clean install -PautoInstallPackage
Installing only bundle into AEM instance:
mvn clean install -PautoInstallBundle
Adding the release version for your package via maven command:
mvn clean install -PautoInstallPackage -drelease.version=1.0.0
Skipping the unit tests written in java code during build:
Package build: mvn clean install -PautoInstallPackage -DskipTests
Bundle build: mvn clean install -PautoInstallBundle -DskipTests
Adding the profile in maven command:
mvn clean install -PautoInstallPackage -padobe-public
To build a single package:
mvn clean install -PbuildSinglePackage
To build and install single package on an AEM instance:
mvn clean install -PbuildSinglePackage -PautoInstallSinglePackage
Read Full Blog
Q&A
Please use this thread to ask the related questions.
Kautuk Sahni