21.8.15

Maven command cheatsheet

All commands to be executed from the project root folder containing the pom.xml

mvn help:effective-pom
Displays a much larger POM which exposes the default settings of Maven.

mvn jar:jar
This packs up [creates a package] the entire project into a .JAR file, and places it under {basedir}/target folder, with a name like 'BDD-1.0-SNAPSHOT.jar'.
This can be used to zip-up the projects and move around.

mvn site
This will execute the site lifecycle phase. This lifecycle is concerned solely with processing site content under the src/site directories and generating reports. After this command executes, you should see a project web site in the target/site directory. Load target/site/index.html and you should see a basic shell of a project site. 
You can customize site reports by configuring which reports are included in a build via the pom.xml file. JBehave uses this feature to create those result reports, and the format of those reports is implemented via .FTL files.

mvn dependency:resolve
This will list down all the dependencies [jars, versions, etc], and their scope, including the implicit transient [child] dependencies.

mvn dependency:tree
This will list down all the dependencies in your pom, along with the transient dependency for each of those - which dependency in your pom has its own implicit child dependency.

mvn install assembly:assembly
In this the 'assembly' goal is executed by the 'assembly' plugin, after the Maven build reaches the 'install' lifecycle phase. This shows an example of commands using life-cycle phases and plugin goals.

mvn clean > clean.txt
This will run the clean command and output the result text in the clean.txt file in the root dir.



No comments:

Post a Comment