Turn: mvn common commands

Maven common commands: 
1. Create a common Maven java project: 
   mvn archetype:create 
   -DgroupId=packageName 
   -DartifactId=projectName  
2. Create a Maven web project:   
    mvn archetype:create 
    -DgroupId=packageName     -DartifactId
    =webappName 
    -DarchetypeArtifactId=maven- archetype-webapp    
3. Compile the source code: mvn compile 
4. Compile the test code: mvn test-compile    
5. Run the test: mvn test   
6. Generate the site: mvn site   
7. Package: mvn package   
8. Install the jar in the local Repository: mvn install 
9. Clear the generated project: mvn clean   
10. Generate the eclipse project: mvn eclipse:eclipse  
11. Generate the idea project: mvn idea:idea  
12. Use the goal command in combination, such as only packaging without testing: mvn -Dtest package   
13. Compile the content of the test: mvn test-compile  
14. Only make jar packages: mvn jar:jar  
15. Only test without compiling, without testing and compiling: mvn test -skipping compile -skipping test-compile 
      (the flexible use of -skipping, of course, can also be used for other combined commands)  
16. Clear some system settings of eclipse: mvn eclipse:clean 

ps:

The general usage is like this, first download the code to the machine through cvs or svn, then execute mvn eclipse:eclipse to generate the ecllipse project file, and then import it into eclipse; after modifying the code, execute mvn compile or mvn test to check, you can also download eclipse maven plugin.

mvn -version/-v display version information 
mvn archetype:generate create mvn project 
mvn archetype:create -DgroupId=com.oreilly -DartifactId=my-app create mvn project

mvn package Generate target directory, compile and test code, generate test report, generate jar/war file 
mvn jetty:run Run the project on jetty, 
mvn compile Compile 
mvn test Compile and test 
mvn clean Empty generated files 
mvn site Generate project related information Web site 
mvn -Dwtpversion=1.0 eclipse:eclipse Generate Wtp plug-in Web project 
mvn -Dwtpversion=1.0 eclipse:clean Clear the configuration information of the Eclipse project (Web project) 
mvn eclipse:eclipse Convert the project into an Eclipse project

在应用程序用使用多个存储库 
<repositories>    
    <repository>      
        <id>Ibiblio</id>      
        <name>Ibiblio</name>      
        <url>http://www.ibiblio.org/maven/</url>    
    </repository>    
    <repository>      
        <id>PlanetMirror</id>      
        <name>Planet Mirror</name>      
        <url>http://public.planetmirror.com/pub/maven/</url>    
    </repository>  
</repositories>


mvn deploy:deploy-file -DgroupId=com -DartifactId=client -Dversion=0.1.0 -Dpackaging=jar -Dfile=d:\client-0.1.0.jar -DrepositoryId=maven-repository-inner -Durl=ftp://xxxxxxx/opt/maven/repository/


发布第三方Jar到本地库中:

mvn install:install-file -DgroupId=com -DartifactId=client -Dversion=0.1.0 -Dpackaging=jar -Dfile=d:\client-0.1.0.jar


-DdownloadSources=true

-DdownloadJavadocs=true

mvn -e              显示详细错误 信息. 
mvn validate        验证工程是否正确,所有需要的资源是否可用。 
mvn test-compile    编译项目测试代码。 。 
mvn integration-test     在集成测试可以运行的环境中处理和发布包。 
mvn verify               运行任何检查,验证包是否有效且达到质量标准。     
mvn generate-sources     产生应用需要的任何额外的源代码,如xdoclet。

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/lifxue/archive/2009/10/14/4662902.aspx

常用命令: 
mvn -v 显示版本 
mvn help:describe -Dplugin=help 使用 help 插件的  describe 目标来输出 Maven Help 插件的信息。 
mvn help:describe -Dplugin=help -Dfull 使用Help 插件输出完整的带有参数的目标列 
mvn help:describe -Dplugin=compiler -Dmojo=compile -Dfull 获取单个目标的信息,设置  mojo 参数和  plugin 参数。此命令列出了Compiler 插件的compile 目标的所有信息 
mvn help:describe -Dplugin=exec -Dfull 列出所有 Maven Exec 插件可用的目标 
mvn help:effective-pom 看这个“有效的 (effective)”POM,它暴露了 Maven的默认设置

mvn archetype:create -DgroupId=org.sonatype.mavenbook.ch03 -DartifactId=simple -DpackageName=org.sonatype.mavenbook 创建Maven的普通java项目,在命令行使用Maven Archetype 插件 
mvn exec:java -Dexec.mainClass=org.sonatype.mavenbook.weather.Main Exec 插件让我们能够在不往 classpath 载入适当的依赖的情况下,运行这个程序 
mvn dependency:resolve 打印出已解决依赖的列表 
mvn dependency:tree 打印整个依赖树

mvn install -X 想要查看完整的依赖踪迹,包含那些因为冲突或者其它原因而被拒绝引入的构件,打开 Maven 的调试标记运行 
mvn install -Dmaven.test.skip=true 给任何目标添加maven.test.skip 属性就能跳过测试 
mvn install assembly:assembly 构建装配Maven Assembly 插件是一个用来创建你应用程序特有分发包的插件

mvn jetty:run     调用 Jetty 插件的 Run 目标在 Jetty Servlet 容器中启动 web 应用 
mvn compile       编译你的项目 
mvn clean install 删除再编译

mvn hibernate3:hbm2ddl 使用 Hibernate3 插件构造数据库

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326359147&siteId=291194637
Recommended