0

我有以下阴影插件配置:

<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 中,我看到依赖项正在使用版本进行硬编码

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

有没有办法可以完全删除依赖项,或者只是删除硬编码的版本?

4

1 回答 1

0

经过进一步分析,我发现他们是无法删除硬编码版本的。您可以尝试的替代方法是 maven-assembly 插件,但它提供的灵活性很小。

于 2014-12-24T06:09:19.460 回答