You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何排除gson以通过jira-maven-plugin的依赖校验规则

解决JIRA Maven插件对Gson依赖的校验排除问题

核心解决思路

保留Gson 2.10.1的依赖,同时通过jira-maven-plugin的配置,明确让插件跳过对该依赖的禁用校验,或者将其加入允许列表。


具体配置步骤

  1. 保留Gson依赖
    在项目的pom.xml中确保Gson依赖存在(不要移除),根据需求设置合适的scope:

    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.10.1</version>
        <!-- 若JIRA内置Gson版本不满足需求,用compile;仅插件内部使用可设为runtime -->
        <scope>compile</scope>
    </dependency>
    
  2. 配置JIRA Maven插件排除校验
    在jira-maven-plugin的配置节点中,添加以下两种方式之一:

    • 方式一:将Gson加入允许依赖列表
      明确指定允许该版本的Gson通过插件校验:
      <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>
              <allowedDependencies>
                  <allowedDependency>
                      <groupId>com.google.code.gson</groupId>
                      <artifactId>gson</artifactId>
                      <version>2.10.1</version>
                  </allowedDependency>
              </allowedDependencies>
          </configuration>
      </plugin>
      
    • 方式二:直接排除对Gson的校验
      跳过插件对Gson依赖的检查(不限制版本):
      <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>
              <dependencyCheckExcludes>
                  <dependencyCheckExclude>com.google.code.gson:gson</dependencyCheckExclude>
              </dependencyCheckExcludes>
          </configuration>
      </plugin>
      

补充说明

  • 优先使用方式一,因为它更精准,仅允许指定版本的Gson通过校验,避免引入其他不安全版本的依赖。
  • 若使用方式二,需确保项目中使用的Gson版本符合JIRA 9.12.5的兼容性要求。

内容的提问来源于stack exchange,提问作者Andreas Panagiotidis

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.26 11:30:12