Maven library:
http://repo2.maven.org/maven2/
Maven dependency query:
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 and test the content: mvn test-compile
14. Only jar package: mvn jar:jar
15. Only test without compiling, and do not test and compile: mvn test -skipping compile -skipping test-compile
( -skipping flexibility Use, of course, it 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 this machine through cvs or svn, and then execute mvn eclipse:eclipse to generate ecllipse project file, and then import it into eclipse; after modifying the code, execute mvn compile or mvn test inspection, you can also download the maven plug-in of eclipse.
发布第三方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。
常用命令:
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 插件构造数据库