有关Maven Shade插件的配置继承

时间:2017-01-07 04:36:24

标签: maven inheritance maven-shade-plugin

目前我的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>

1 个答案:

答案 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>内再次定义插件。您可以删除标记以从父级继承配置。