1

我的自定义插件构建脚本中有一些传递依赖排除。像这样:

configurations {
    compile.exclude group: 'commons-math3', module: 'commons-math3'
}

dependencies {
    'org.apache.jmeter:ApacheJMeter:2.13',
}

使用plugins.gradle.orgcom.gradle.plugin -publish version发布0.9.1时,排除项不会传播到生成的 POM:

<dependency>
  <groupId>org.apache.jmeter</groupId>
  <artifactId>ApacheJMeter</artifactId>
  <version>2.13</version>
  <scope>compile</scope>
</dependency>

有解决方法吗?我可以以某种方式使用插件发布的withDependencies扩展吗?

Maven-publish插件有(或至少曾经有)类似的问题。看这里

更新: 此问题尚未解决,现在记录为 gradle 缺陷。

4

1 回答 1

0

在依赖项中排除模块,它是以下的传递依赖项:

dependencies {
    compile('org.apache.jmeter:ApacheJMeter:2.13') {
        exclude group: 'commons-math3', module: 'commons-math3'
    }
}

这就是你将在生成的 POM 中得到的:

<dependency>
  <groupId>org.apache.jmeter</groupId>
  <artifactId>ApacheJMeter</artifactId>
  <version>2.13</version>
  <scope>compile</scope>
  <exclusions>
    <exclusion>
      <artifactId>commons-math3</artifactId>
      <groupId>commons-math3</groupId>
    </exclusion>
  </exclusions>
</dependency>
于 2015-07-30T16:59:39.433 回答