天天看点

maven打包之eclipse中如何打对应maven项目的jar或者war包1.如何决定打jar包还是war包2.eclipse中运行maven install3.备注 如何确定包生成在那里

maven打包之eclipse中如何打对应maven项目的jar或者war包

1.如何决定打jar包还是war包

通过pom.xml中的配置决定,packaging值为jar或war

maven打包之eclipse中如何打对应maven项目的jar或者war包1.如何决定打jar包还是war包2.eclipse中运行maven install3.备注 如何确定包生成在那里

2.eclipse中运行maven install

maven打包之eclipse中如何打对应maven项目的jar或者war包1.如何决定打jar包还是war包2.eclipse中运行maven install3.备注 如何确定包生成在那里

eclipse 控制台输出

[WARNING] 
[WARNING] Some problems were encountered while building the effective settings
[WARNING] Unrecognised tag: 'mirror' (position: START_TAG seen ...e the preferred\n   | server for that repository.\n   |-->\n\t<mirror>... @146:10)  @ E:\using\apache-maven-3.3.1\conf\settings.xml, line 146, column 10
[WARNING] Unrecognised tag: 'mirror' (position: START_TAG seen ...e the preferred\n   | server for that repository.\n   |-->\n\t<mirror>... @146:10)  @ E:\using\apache-maven-3.3.1\conf\settings.xml, line 146, column 10
[WARNING] 
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building demo-base Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ demo-base ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory E:\workspace\github\MyRepository\demo-back-end\demo-base\src\main\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ demo-base ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ demo-base ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory E:\workspace\github\MyRepository\demo-back-end\demo-base\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ demo-base ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ demo-base ---
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ demo-base ---
[INFO] Building jar: E:\workspace\github\MyRepository\demo-back-end\demo-base\target\demo-base.jar
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ demo-base ---
[INFO] Installing E:\workspace\github\MyRepository\demo-back-end\demo-base\target\demo-base.jar to D:\mavenRepository\demo\demo-base\0.0.1-SNAPSHOT\demo-base-0.0.1-SNAPSHOT.jar
[INFO] Installing E:\workspace\github\MyRepository\demo-back-end\demo-base\pom.xml to D:\mavenRepository\demo\demo-base\0.0.1-SNAPSHOT\demo-base-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.774 s
[INFO] Finished at: 2018-10-14T16:45:28+08:00
[INFO] Final Memory: 11M/241M
[INFO] ------------------------------------------------------------------------
           

我们可以看到在

D:\mavenRepository\demo\demo-base\0.0.1-SNAPSHOT

下面生成了 demo-base-0.0.1-SNAPSHOT.jar包

maven打包之eclipse中如何打对应maven项目的jar或者war包1.如何决定打jar包还是war包2.eclipse中运行maven install3.备注 如何确定包生成在那里

3.备注 如何确定包生成在那里

这个是由安装apache-maven的时候自己的本地仓库在哪里决定的;

maven打包之eclipse中如何打对应maven项目的jar或者war包1.如何决定打jar包还是war包2.eclipse中运行maven install3.备注 如何确定包生成在那里

只要在本地仓库里有,那么就会优先先用本地仓库的jar包即可

maven打包之eclipse中如何打对应maven项目的jar或者war包1.如何决定打jar包还是war包2.eclipse中运行maven install3.备注 如何确定包生成在那里

继续阅读