How To Build Project With Maven
To build a Maven based project, open your console, change to your project folder where
pom.xml
file is placed, and issue this command :mvn package
This will execute the Maven “package” phase.
Maven build lifecycle
Maven is run by phases, read this default Maven build lifecycle article for more detail. So, when the “package” phase is executed, all its above phases – “validate“, “compile” and “test“, including the current phase “package” will be executed orderly.
Maven is run by phases, read this default Maven build lifecycle article for more detail. So, when the “package” phase is executed, all its above phases – “validate“, “compile” and “test“, including the current phase “package” will be executed orderly.
“mvn package” example
When you run “
mvn package
” command, it will compile source code, run unit test and pack it depends on your “packaging” tag in pom.xml
file. For example,
1. If “packaging” = jar, it will package your project into a “jar” file and put it into your target folder
File : pom.xml
...>
4.0.0
2. If “packaging” = war, it will package your project into a “war” file and put it into your target folder.
File : pom.xml
...>
4.0.0
No comments:
Post a Comment