【问题标题】:Shade Plugin Harcording Dependency For Excluded Artifact alsoShade Plugin Harcording Dependency For Excluded Artifact 也
【发布时间】:2016-03-19 05:16:41
【问题描述】:

我有以下阴影插件配置:

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

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

【问题讨论】:

    标签: maven maven-shade-plugin uberjar


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-05-30
      • 2014-09-05
      • 1970-01-01
      • 2013-04-11
      • 1970-01-01
      • 2019-03-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多