Commands
Common every-day commands
Command | Description |
---|---|
mvn clean install | Clean, build and test |
mvn clean install -DskipTests | Don't run tests |
mvn compile | |
mvn package | |
mvn test | |
mvn -Ptest,verifier,all,dev-test install -Dit.test=LocalStorageTest | Run a test |
Project startup
Command | Description |
---|---|
>mvn archetype:generate archetype: 888 version: <pick latest> groupId: com.company.something artifactId: AppName (will translate to the jar/war built) version: 1.0-SNAPSHOT package: <groupId value> | Create a new maven project. This command will setup the basic directory structure used by maven projects. You will be prompted for an a number of parameters. For groupId, input your company name or base package name for your code. For artifactId, input t=your application name. |
Maven Lifecycle
Maven defines number of phases. Here are a few:
Lifecycle | Description |
---|---|
validate | Validates your project |
compile | Compiles your code |
test | Runs your tests |
package | Packages your code |
install | Packages and installs to your local repository |
deploy | When publishing your artifact to a public repository (Not typically used) |
Dependencies
In the sample pom.xml file below we can see that we have a dependency on the junit library for the test scope.
pom.xml
|