Maven is a build automation tool used by the java developers. Some of the commands which I use on daily basis are:
Create a Java ProjectAbove is a single line command to create
mvn archetype:create -DgroupId=com.devfaqs.project -DartifactId=MyProject
hello world
java project. The command creates the project in a well defined directory structure along with the provision to write and execute junit test cases for the project createdCompile a ProjectThe compiled classes are stored in
mvn compile
target/classes
directoryPackage a ProjectThe project is packaged in either of the following formats:
mvn package
jar
, war
, ear
Run TestsRun unit tests using a suitable testing framework
mvn test
Clean a ProjectThe target directory is removed from the project
mvn clean
Install the Project to local repositoryThis will install the project package in the local maven repository which usually resides at
mvn install
%USERPROFILE%/.m2
or $HOME/.m2
directoryEclipse IntegrationThe maven project can be imported to eclipse after executing the above command
mvn eclipse:eclipse
Generating Ant build files from MavenThis will generate
mvn ant:ant
build.xml
, maven-build.xml
, maven-build.properties
. The same project can be imported into eclipse using ant build file
No comments :
Post a Comment