File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ ###aven中把依赖的JAR包一起打包
2+
3+ 这里所用到的MAVEN-PLUGIN是MAVNE-ASSEMBLY-PLUGIN
4+ 官方网站是:[ http://maven.apache.org/plugins/maven-assembly-plugin/usage.html ] ( http://maven.apache.org/plugins/maven-assembly-plugin/usage.html )
5+
6+ 1 . 添加此PLUGIN到项目的POM.XML中
7+ ``` java
8+ < build>
9+ < plugins>
10+ < plugin>
11+ < artifactId> maven- assembly- plugin< / artifactId>
12+ < configuration>
13+ < archive>
14+ < manifest>
15+ < mainClass> com.allen.capturewebdata.Main</ mainClass>
16+ < / manifest>
17+ < / archive>
18+ < descriptorRefs>
19+ < descriptorRef> jar- with- dependencies< / descriptorRef>
20+ < / descriptorRefs>
21+ < / configuration>
22+ < / plugin>
23+ < / plugins>
24+ < / build>
25+ ```
26+
27+ 如果出现CLASS重名的情况,这时候就要把最新的版本号添加进去即可.
28+
29+ 2, 在当前项目下执行mvn assembly: assembly , 执行成功后会在target文件夹下多出一个以-jar-with-dependencies结尾的JAR包. 这个JAR包就包含了项目所依赖的所有JAR的CLASS.
30+
31+ 3.如果不希望依赖的JAR包变成CLASS的话,可以修改ASSEMBLY插件.
32+
33+ 3.1 找到assembly在本地的地址,一般是c:/users/${your_login_name}/.m2/\org\apache\maven\plugins\maven-assembly-plugin\2.4
34+
35+ 3.2 用WINZIP或解压工具打开此目录下的maven-assembly-plugin-2.4.jar, 找到assemblies\jar-with-dependencies.xml
36+
37+ 3.3 把里面的UNPACK改成FALSE即可
You can’t perform that action at this time.
0 commit comments