天天看點

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.備注 如何确定包生成在那裡

繼續閱讀