如何修复 jira-maven-plugin 的验证规则

问题描述 投票:0回答:1

我使用 jira-maven-plugin 为 JIRA 创建插件

<build>
    <plugins>
        <plugin>
            <groupId>com.atlassian.maven.plugins</groupId>
            <artifactId>jira-maven-plugin</artifactId>
            <version>8.15.0</version>
            <extensions>true</extensions>

            <configuration>
                <productVersion>9.12.5</productVersion>
                <productDataVersion>9.12.5</productDataVersion>
                   ....

自从使用 jira-maven-plugin 8.15.0 以来,maven 抱怨 gson 依赖被禁止

[INFO] --- jira-maven-plugin:8.15.0:validate-banned-dependencies (default-validate-banned-dependencies) @ my-jira-rest-plugin ---
[INFO] validate banned dependencies
[INFO] Dependencies excluded from banning: []
[INFO] Platform version range: '[0,)'
[WARNING] Rule 0: org.apache.maven.plugins.enforcer.BannedDependencies failed with message:
make sure platform artifacts are not bundled into plugin
Found Banned Dependency: com.google.code.gson:gson:jar:2.10.1
Use 'mvn dependency:tree' to locate the source of the banned dependencies.

如果没有 gson 库,当我们上传需要 gson 的 orb(插件库)时,JIRA 会抱怨。

<dependency>
    <groupId>com.google.code.gson</groupId>
    <artifactId>gson</artifactId>
    <version>2.10.1</version>
</dependency>

如何从 jira-maven-plugin 的验证中排除 gson?

validation gson rules jira-maven-plugin
1个回答
0
投票

解决方案很简单,在尝试了各种插件等之后,出乎意料的是我必须设置maven-enforcer-plugin

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-enforcer-plugin</artifactId>
    <version>3.4.1</version>
    <configuration>
        <rules>
            <bannedDependencies>
                 <excludes>
                     <exclude>com.google.code.gson:gson:jar:2.10.1</exclude>
                 </excludes>
            </bannedDependencies>
        </rules>
        <fail>true</fail>
    </configuration>
</plugin>
        
© www.soinside.com 2019 - 2024. All rights reserved.