莫里亚蒂教授Maven命令⾏使⽤:mvncleanpackage(打包)
转⾃:
先把命令⾏切换到Maven项⽬的根⽬录,⽐如:/d/xxxwork/java/maven-test,然后执⾏命令: mvn clean package工作强度
执⾏结果如下:
[INFO] Scanning
[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 t, using platform encoding GBK, i.e. build is platform dependent!
[INFO] Compiling 13 source files to D:\CtripWork\Java\maven-test\target\class
[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 class 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] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.284 s
[INFO] Finished at: 2016-11-14T15:36:55+08:00
[INFO] Final Memory: 15M/77M
[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\class⽬录下(版本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⽬录下(这个⽣成的包不能在命令⾏中直接执⾏,因为我们还没有⼊⼝类配置到Manifest资源配置⽂件中去,后续会阐述)。
备注:
不管是compile、package还是install等前三个步骤都是必不可少的。