问题
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