还为排除工件提供了Shade Plugin Harcording依赖关系 [英] Shade Plugin Harcording Dependency For Excluded Artifact also

查看:141
本文介绍了还为排除工件提供了Shade Plugin Harcording依赖关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下阴影插件配置:

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>

我看到XXXX:client被排除在maven依赖之外,但是在生成的pom中,我看到依赖正在使用版本进行硬编码

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 ?

推荐答案

在进一步分析中,我发现他们无法删除硬编码版本.您可以尝试使用的替代方法是maven-assembly插件,但灵活性极低.

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.

这篇关于还为排除工件提供了Shade Plugin Harcording依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆