mvn clean install -Dmaven.test.skip=true -U
清理项目生产的临时文件,一般是模块下的target目录。同时执行模块安装命令 将打包的的jar/war文件复制到你的本地仓库中,供其他模块使用 -Dmaven.test.skip=true 跳过测试(同时会跳过test compile),而-U强制更新
mvn clean install -e -U
-e详细异常,-U强制更新
$ mvn clean install执行结果如下:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building rtp-front 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ rtp-front ---
[INFO] Deleting D:\xxxwork\Java\maven-test\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ rtp-front ---
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ rtp-front ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent!
[INFO] Compiling 13 source files to D:\xxxwork\Java\maven-test\target\classes
[WARNING] /D:/xxxwork/Java/maven-test/src/main/java/ReadOnly.java: 某些输入文件使用了未经检查或不安全的操作。
[WARNING] /D:/xxxwork/Java/maven-test/src/main/java/ReadOnly.java: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ rtp-front ---
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\xxxwork\Java\maven-test\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ rtp-front ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ rtp-front ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ rtp-front ---
[INFO] Building jar: D:\xxxwork\Java\maven-test\target\rtp-front-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ rtp-front ---
[INFO] Installing D:\xxxwork\Java\maven-test\target\rtp-front-1.0-SNAPSHOT.jar to d:\Users\xyz\.m2\repository\com\xyz\finance\rtp\rtp-front\1.0-SNAPSHOT\rtp-front-1.0-SNAPSHOT.jar
[INFO] Installing D:\xxxwork\Java\maven-test\pom.xml to d:\Users\xyz\.m2\repository\com\xyz\finance\rtp\rtp-front\1.0-SNAPSHOT\rtp-front-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.892 s
[INFO] Finished at: 2016-11-14T16:10:35+08:00
[INFO] Final Memory: 15M/76M
[INFO] ------------------------------------------------------------------------
执行顺序:
1、使用清理插件:maven-clean-plugin:2.5执行清理删除已有target目录(版本2.5);
2、使用资源插件:maven-resources-plugin:2.6执行资源文件的处理(版本2.6);
3、使用编译插件:maven-compiler-plugin:3.1编译所有源文件生成class文件至target\classes目录下(版本3.1);
4、使用资源插件:maven-resources-plugin:2.6执行测试资源文件的处理(版本2.6);
5、使用编译插件:maven-compiler-plugin:3.1编译测试目录下的所有源代码(版本3.1);
6、使用插件:maven-surefire-plugin:2.12运行测试用例(版本2.12);
7、使用插件:maven-jar-plugin:2.4对编译后生成的文件进行打包,包名称默认为:artifactId-version,比如本例生成的jar文件:rtp-front-1.0-SNAPSHOT,包文件保存在target目录下;
8、使用maven-install-plugin:2.4把上述打包生成的jar包和pom文件安装到本地的仓库中(一般默认的路径为:%HOMEPATH%\.m2\repository\pom中groupId按.分隔的目录层次\pom中的artifactId\pom中的version\jar包的名称)。
个性签名:一个人在年轻的时候浪费自己的才华与天赋是一件非常可惜的事情
如果觉得这篇文章对你有小小的帮助的话,记得在右下角“点赞”~“评论” “收藏”哦,博主在此感谢!
万水千山总是情,打赏5毛买辣条行不行,所以如果你心情还比较高兴,也是可以扫码打赏博主,哈哈哈(っ•̀ω•́)っ✎⁾⁾!