目前我的Maven Shade插件的配置继承存在问题,我的意思是artifactSet
并且每当我删除phase
和{goals
时,它下面的所有配置选项都会变为红色{1}}选项(意图从父pluginManagement
部分继承。
我将首先展示我在父母身上所拥有的东西以及我想要完成的东西。
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
<plugin>
</plugins>
</pluginManagement>
</build>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<configuration>
<artifactSet>
<includes>
<include>...</include>
</includes>
</artifactSet>
</configuration>
</execution>
</executions>
<plugin>
</plugins>
</pluginManagement>
</build>
答案 0 :(得分:1)
1 - 您在此处缺少类型<execution>
-
更改
<executions>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</executions>
到
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
2 - 要从父pom.xml继承配置,您需要确保子pom 不在<pluginManagement>
内再次定义插件。您可以删除标记以从父级继承配置。