读书人

maven下令

发布时间: 2012-07-16 15:44:59 作者: rapoo

maven命令
--下载源代码和文档
mvn install dependency:sources -DdownloadSources=true -DdownloadJavadocs=true


mvn archetype:generate 列出所有可用的模板供选择并创建

mvn dependency:analyze 使用Maven Dependency插件进行优化
mvn dependency:resolve 已解决依赖的列表
mvn dependency:tree 项目的整个依赖树

mvn install -X 查看完整的依赖踪迹,包含那些因为冲突或者其它原因而被拒绝引入的构件 (慎用,输出信息巨大)

mvn scm:checkin -Dmessage="Message"
mvn scm:checkout
mvn scm:update

mvn help:effective-pom 查看项目的有效POM
mvn help:active-profiles 列出活动的Profile

mvn eclipse:eclipse 生成eclipse项目
mvn eclipse:clean

mvn test -Dtest=MyTest 只对src.test.java下的MyTest类进行测试
mvn test -Dtest=MyTest -DfailIfNoTests=false 如果测试类里没有测试方法不报错

mvn package -Dmaven.test.skip=true 打包之前不执行单元测试

mvn jetty:run jetty插件运行web程序

exec插件可以用来运行程序
surefire插件可以用来测试程序

mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-web

下载依赖包的源代码:mvn dependency:sources

-DdownloadSources=true

-DdownloadJavadocs=true


mvn clean install -Pproduction -X

mvn install -Dmaven.test.skip=true
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>

mvn assembly:assembly
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>

mvn install:install-file
-Dfile=<path-to-file>
-DgroupId=<group-id>
-DartifactId=<artifact-id>
-Dversion=<version>
-Dpackaging=<packaging>

-DgeneratePom=true
-DcreateChecksum=true
-DpomFile=path-to-pom
-DlocalRepositoryPath=path-to-specific-local-repo
-DlocalRepositoryId=id-for-specific-local-repo

mvn deploy:deploy-file
-Durl=file
-DrepositoryId=some.id
-Dfile=path-to-your-artifact-jar
-DgroupId=your.groupId
-DartifactId=your-artifactId
-Dversion=version
-Dpackaging=jar
-DgeneratePom=false
-DpomFile=path-to-your-pom.xml
-Dclassifier=bin
-DuniqueVersion=false

mvn archetype:generate
-DarchetypeGroupId=org.simple
-DarchetypeArtifactId= simple
-DarchetypeVersion=1.0-SNAPSHOT

读书人网 >软件架构设计

热点推荐