Shade Plugin Harcording Dependency For Excluded Artifact also

狂风中的少年 提交于 2019-12-13 07:35:53

问题


I have the following shade plugin config :

<build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.2</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <createSourcesJar>false</createSourcesJar>
                            <keepDependenciesWithProvidedScope>true</keepDependenciesWithProvidedScope>
                            <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
                            <artifactSet>
                                <includes>
                                    <include>XXXX:AAAA-common</include
                                </includes>
                                <excludes>
                                    <exclude>XXXX:client</exclude>
                                </excludes>
                            </artifactSet>
                            <finalName>${project.artifactId}-${project.version}</finalName>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

I see that the XXXX:client is being excluded from the maven dependency, but in that pom that gets generated, I see that the dependency is getting hard coded with the version

<dependency>
   <groupId>XXXX</groupId>
   <artifactId>client</artifactId>
   <version>1.2.3</version>
   <scope>compile</scope>
</dependency>

Is there a way we can remove the dependency entirely, or just remove the hardcoded version ?


回答1:


On further analysis, I found that their is no way we can remove the hardcoded version. An alternative which you can try is maven-assembly plugin but it provides very little flexibility.



来源:https://stackoverflow.com/questions/26990049/shade-plugin-harcording-dependency-for-excluded-artifact-also

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!