How to use maven2.0 -quick start

来源:互联网 发布:网络大电影票房排行 编辑:程序博客网 时间:2024/05/17 01:05

 create project:
 mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-app

if you want to create other type project you can do that

mvn archetype:create -DgroupId=cn.sqsoft -DartifactId=sqsoft

mvn archetype:create -DgroupId=cn.sqsoft.steel -DartifactId=sqsoft-steel -DarchetypeArtifactId=maven-archetype-webapp


compile application sources:
 mvn compile
run unit tests:
 mvn test
compile test source:
 mvn test-compile
create a jar and install it in my local repository
 mvn package
 mvn install

we have walked through the process for setting up, building,testing,packaging,and installing a typical Maven project.

generating the site is very simple,and fast.
 mvn site

--------------------------------------------
How do i build other types of projects?
 mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-webapp
--------------------------------------------
How do i build more than one project at once?
 mvn clean install
--------------------------------------------
How do i using Maven 2 to generate Eclipse project files?
 mvn eclipse:eclipse

Eclipse needs to know the path to the local maven repository. Therefore the casspath variable M2_REPO has to be set.so we should execute the following command:
How do i define a classpath variable for your maven repository?
 $ cd workspace_dir
 $ mvn -Declipse.workspace=. eclipse:add-maven-repo

原创粉丝点击