maven常用命令

mvn archetype:crate 创建maven项目
mvn compile 编译源代码
mvn test-compile 编译测试代码
mvn test 运行应用程序中的单元测试
mvn site 生成项目相关信息的网站
mvn clean 清除目标目录中的生成结果
mvn package 依据项目生成jar文件
mvn install 在本地repository中安装jar

mvn intall -Dmaven.test.skip=true 忽略测试文档编译

转化为eclipse项目
mvn eclipse:clean 清除eclipse项目文件
mvn eclipse:eclipse 生成eclipse项目文件


安装jar包到repository中
mvn install:install-file -Dfile=D:antlrantlr2.7.7antlr-2.7.7.
jar -DgroupId=antlr -DartifactId=antlr -Dversion=2.7.7 -Dpackaging=jar

scope 中 的默认是compile

比较好的maven 仓库网站
http://mavenrepository.com/

compile:默认使用该依赖,对编译,测试,运行三种classpath都有效
test :只对测试有效,如junit
provided:在运行时无效,对编译和测试有效,如servlet-api
runtime:如JDBC,对测试和运行有效,在编译时无效

运行Main方法
mvn exec:java -Dexec.mainClass=packageName.className

查看插件信息
mvn help:describe -Dplugin=eclipse

原文地址:https://www.cnblogs.com/fuyuanming/p/5079305.html