You only need to learn a small set of commands to build any Maven project, and the pom.xml file will ensure you get the expected results. Each build phase represents a stage in the lifecycle, here are the ones that you may need:
test- test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed.
When building and deploying your project, Test Cases will be generated as JUnit files and thus will be built before the packaging Maven phase.
package- takes the compiled code and package it in its distributable format, such as a JAR.
If you want to exclude Java code from the generated zip file when using the package maven goal, add the !include-java-sources parameter as follows:
mvn clean package -P !include-java-sources
install- installs the package into the local repository, for use as a dependency in other projects locally
deploy- done in the build environment, copies the final package to the remote repository for sharing with other developers and projects.
For more information on the Maven phases, see the Maven documentation.