标签:arc archive ref dep cut config manage dea 打包
在 pom.xml 中添加了如下配置后,打包出来的依然是普通的 xxxx.jar 文件,并没有后面的 jar-with-dependencies
,经过网上多方寻找之后,参考这篇文章 得到解决
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<archive>
<manifest>
<mainClass>com.xjr7670.Hello</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
原因是以上配置被放置在了 pluginManagement
里面了,把以上配置放在 pluginManagement
外面即可。或者直接不要
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<archive>
<manifest>
<mainClass>com.xjr7670.Hello</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
标签:arc archive ref dep cut config manage dea 打包
原文地址:https://www.cnblogs.com/wuzhiblog/p/12584243.html