Plugin not honouring exclusions in POM

plugins

(Sion Williams) #1

I have developed a plugin which can be seen, here.

As you can see in the build script I have explicitly stated that I want to exclude certain transitive dependencies:

/**
 * SoapUI dependencies
 */
compile ('com.smartbear.soapui:soapui:5.0.1') {
    exclude module: 'commons-logging'
    exclude module: 'log4j'
    exclude module: 'jtidy'
    exclude module: 'cajo'
    exclude group: 'org.codehaus.groovy'
}

Despite this also being reflected in the POM which is produced by publishPlugin:

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <groupId>gradle.plugin.io.byteshifter</groupId>
  <artifactId>soapui-gradle-plugin</artifactId>
  <version>0.2</version>
  <dependencies>
    <dependency>
      <groupId>com.smartbear.soapui</groupId>
      <artifactId>soapui</artifactId>
      <version>5.0.1</version>
      <scope>compile</scope>
      <exclusions>
        <exclusion>
          <artifactId>commons-logging</artifactId>
        </exclusion>
        <exclusion>
          <artifactId>log4j</artifactId>
        </exclusion>
        <exclusion>
          <artifactId>jtidy</artifactId>
        </exclusion>
        <exclusion>
          <artifactId>cajo</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.codehaus.groovy</groupId>
        </exclusion>
      </exclusions>
    </dependency>
  </dependencies>
</project>

The dependencies are still being attempted.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'g'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not resolve jtidy:jtidy:r872-jdk15.
     Required by:
         :g:unspecified > gradle.plugin.io.byteshifter:soapui-gradle-plugin:0.2 > com.smartbear.soapui:soapui:5.0.1
      > Could not resolve jtidy:jtidy:r872-jdk15.
         > inconsistent module metadata found. Descriptor: jtidy:jtidy:r872 Errors: bad version: expected='r872-jdk15' found='r872'
   > Could not resolve gnu.cajo:cajo:1.142.
     Required by:
         :g:unspecified > gradle.plugin.io.byteshifter:soapui-gradle-plugin:0.2 > com.smartbear.soapui:soapui:5.0.1
      > Could not resolve gnu.cajo:cajo:1.142.
         > inconsistent module metadata found. Descriptor: cajo:cajo:1.142 Errors: bad group: expected='gnu.cajo' found='cajo'

However, if I put an exclude in the consuming build, everything works fine:

buildscript {
  repositories {
    maven { url "https://plugins.gradle.org/m2/" }
    maven { url "http://www.soapui.org/repository/maven2/" }
    mavenCentral()
  }
  dependencies {
    classpath ("gradle.plugin.io.byteshifter:soapui-gradle-plugin:0.2") {
        exclude module: 'commons-logging'
        exclude module: 'log4j'
        exclude module: 'jtidy'
        exclude module: 'cajo'
        exclude group: 'org.codehaus.groovy'
      }
  }
}

version = "0.0.1"
description = "Tests"

apply plugin: 'io.byteshifter.soapui'

soapui {
    test {
        projectFile = 'AT-test-soapui-project.xml'
        testSuite = 'alphaTracker'
        printReport = true
        junitReport = true
    }
}

This behaviour is a little confusing. Is this actually known with Gradle or am I doing something odd?


(Piotr Jagielski) #2

Which version of Gradle you are using?


(Sion Williams) #3

I used Gradle 2.11 on this occasion.