Gradle doesn't support relocated artifacts if they are part of transitive dependencies


(Natalia Yastrebova) #1

Hello,

We still experience issue related to the artifacts relocation, when the artifacts are the part of the transitive dependencies, quite similar to this: http://issues.gradle.org/browse/GRADLE-2812

We have oracle artifacts relocated within the same repository from one groupID to another (see pom example below).

During dependency resolution Gradle downloads the poms from the old location:

Download http://artifactory/development/oracle/ojdbc7/12.1.1/ojdbc7-12.1.1.pom
Download http://artifactory/development/oracle/orai18n/12.1.1/orai18n-12.1.1.pom
Download http://artifactory/development/oracle/ucp/12.1.1/ucp-12.1.1.pom

But silently doesn’t pick up the jars from a new location at all, without any notification.

And as far as it’s a transitive dependencies even compilation goes through smoothly.

But tests are failed due to the missing oracle classes.

Is this behaviour intentional?

Example of pom file:

<?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">
  <modelVersion>4.0.0</modelVersion>
  <groupId>oracle</groupId>
  <artifactId>ojdbc7</artifactId>
  <version>12.1.1</version>
  <packaging>jar</packaging>
   <distributionManagement>
    <relocation>
      <groupId>com.oracle</groupId>
    </relocation>
  </distributionManagement>
</project>

For experiment, I’ve added to my project ojdbc7 as direct dependency with correct GAV

com.oracle:ojdbc7:12.1.1

And result of the command dependencyInsight shows that Gradle doesn’t correctly resolve them. I have 2 dependencies with different groupId.

:dependencyInsight
//this is my new direct deps
com.oracle:ojdbc7:12.1.1
\--- compile
//this comes from another project pom.
oracle:ojdbc7:12.1.1
+--- pm-core:3.1.2
|
  +--- compile
|
  \--- pm-module-test-environment:1.0.1-20140320-175130
|
       \--- compile