POM exclusions not used for dependencies


(Tobias Bieniek) #1

I have a dependency on a project that includes the following dependency in its POM file:

<dependency>
      <groupId>org.example</groupId>
      <artifactId>example</artifactId>
      <version>1.2.3</version>
      <scope>runtime</scope>
      <exclusions>
        <exclusion>
          <groupId>*</groupId>
          <artifactId>*</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

when I add this project as a dependency in my ‘build.gradle’ file I would expect ‘gradle dependencies’ to show only:

my-project -> other-project -> example:1.2.3

but instead all the transitive dependencies of ‘example:1.2.3’ are also listed. It looks as if the ‘exclusions’ tag in the POM file is simply ignored by the gradle dependency resolution.

Is there a solution to this problem? Did I misunderstand anything?


(Peter Niederwieser) #2

As far as I know, ‘*’ is not a valid notation for exclusions in Maven POMs. Where did you get this from?


(Tobias Bieniek) #3

http://maven.apache.org/pom.html#Exclusions - see second example


(Peter Niederwieser) #4

Thanks. I don’t think this form of exclusion is currently supported by Gradle. Raised GRADLE-3115.


(Tobias Bieniek) #5

Thanks! It would also be great if ‘maven-publish’ could generate such exclusions if ‘transitive’ is set to ‘false’ for certain dependencies, or at least when exclusions are explicitly specificed in the ‘gradle.build’ file.