# Transitive dependencies with non-Java code

**URL:** <https://discuss.gradle.org/t/transitive-dependencies-with-non-java-code/7038>\
**Category:** Old Forum Archive\
**Created:** [November 3, 2012, 10:55pm UTC](https://discuss.gradle.org/t/transitive-dependencies-with-non-java-code/7038 "2012-11-03T22:55:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pinter\_Lorant](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/pinter_lorant/32/636_2.png) [@Pinter\_Lorant](https://discuss.gradle.org/u/Pinter_Lorant)\
**Post date:** [November 3, 2012, 10:55pm UTC](https://discuss.gradle.org/t/transitive-dependencies-with-non-java-code/7038/1 "2012-11-03T22:55:00Z")

</div>

I’d like to get the dependency mechanism to work in Gradle with a non-Java programming platform. The platform is called Haxe, but it could as well be Python or Perl.

I publish each of my modules as a ZIP file accompanied by a pom.xml that lists the module’s metadata (group, name, version) and its dependencies (other similar modules packages as ZIP+pom.xml). The artifacts are stored in a Maven repository (Sonatype Nexus):

[![](https://sea1.discourse-cdn.com/gradle/uploads/default/1248/cebc088e16bb2029.png)](https://d37wxxhohlp07s.cloudfront.net/s3_images/813591/Screen%20Shot%202012-11-03%20at%2011.44.10%20PM.png?1351982675)

The pom.xml looks like this:

```gradle
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <!-- ... -->
  <packaging>zip</packaging>
  <dependencies>
    <dependency>
      <groupId>haxelib</groupId>
      <artifactId>mcover</artifactId>
      <version>1.4.0</version>
      <type>zip</type>
    </dependency>
    <!-- ... -->
  </dependencies>
</project>

```

This works fine for non-transitive dependencies that I can use like this:

```gradle
configurations {
 haxelibs
}
  dependencies {
    haxelibs module(group: "haxelib", name: "munit", version: "0.9.5.2", ext: "zip")
    haxelibs module(group: "haxelib", name: "hamcrest", version: "1.0.1", ext: "zip")
}

```

However, this approach does not seem to handle transitive dependencies. How can I get Gradle to fetch the transitive dependencies as well?

---

<div class="post-metadata">

**Author:** ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)\
**Post date:** [November 3, 2012, 11:57pm UTC](https://discuss.gradle.org/t/transitive-dependencies-with-non-java-code/7038/2 "2012-11-03T23:57:00Z")

</div>

You are using [client module dependencies](http://gradle.org/docs/current/userguide/userguide_single.html#sub:client_module_dependencies), whose very purpose is to ignore the POM and control transitive dependencies from within the build script. Also, specifying an extension means you are referring to a single file rather than a module (which may include transitive dependencies). Try this instead:

```gradle
dependencies {
  haxelibs "haxelib:munit:0.9.5.2"
}

```

---

<div class="post-metadata">

**Author:** ![Pinter\_Lorant](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/pinter_lorant/32/636_2.png) [@Pinter\_Lorant](https://discuss.gradle.org/u/Pinter_Lorant)\
**Post date:** [November 4, 2012, 2:26am UTC](https://discuss.gradle.org/t/transitive-dependencies-with-non-java-code/7038/3 "2012-11-04T02:26:00Z")

</div>

Thanks, this solved one half of the problem.

The other half is that I still have to add { transitive = true } to each dependency, because by default they are intransitive. The haxelibs configuration itself is defined (by default) as transitive, so I wonder: why are the dependencies added to it become intransitive by default?

Now I can work around this by adding this to my build:

```gradle
configure(configurations.haxelibs.dependencies) {
    transitive = true
}

```

…but it would be a lot more convenient if this was the default. Can I do that somehow?

---

<div class="post-metadata">

**Author:** ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)\
**Post date:** [November 4, 2012, 2:35am UTC](https://discuss.gradle.org/t/transitive-dependencies-with-non-java-code/7038/4 "2012-11-04T02:35:00Z")

</div>

This shouldn’t be necessary. There must be something else going on in your build (script) that’s causing this.

---

<div class="post-metadata">

**Author:** ![Pinter\_Lorant](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/pinter_lorant/32/636_2.png) [@Pinter\_Lorant](https://discuss.gradle.org/u/Pinter_Lorant)\
**Post date:** [November 4, 2012, 2:51am UTC](https://discuss.gradle.org/t/transitive-dependencies-with-non-java-code/7038/5 "2012-11-04T02:51:00Z")

</div>

I did this just now:

```gradle
group = "test"
version = "1.0-SNAPSHOT"
  repositories {
    maven {
        credentials {
            username "$nexusUser"
            password "$nexusPassword"
        }
        url "$nexusRepositoriesUrl/thirdparty"
    }
    maven {
        credentials {
            username "$nexusUser"
            password "$nexusPassword"
        }
        url "$nexusRepositoriesUrl/releases"
    }
    mavenCentral()
    mavenLocal()
}
  configurations {
    haxelibs { println "Haxelibs transitive: " + transitive }
    compile { println "Compile transitive: " + transitive }
}
  dependencies {
    haxelibs ("haxelib:munit:0.9.5.2@zip") { println "MUnit transitive: " + transitive }
    compile ("haxelib:munit:0.9.5.2@zip") { println "MUnit/compile transitive: " + transitive }
    compile ("org.apache.commons:commons-io:1.3.2") { println "commons-io/compile transitive: " + transitive }
}

```

And this is what I got back:

```gradle
Haxelibs transitive: true
Compile transitive: true
MUnit transitive: false
MUnit/compile transitive: false
commons-io/compile transitive: true
:dependencies
  ------------------------------------------------------------
Root project
------------------------------------------------------------
  compile
+--- haxelib:munit:0.9.5.2
\--- org.apache.commons:commons-io:1.3.2
     \--- commons-io:commons-io:1.3.2
  haxelibs
\--- haxelib:munit:0.9.5.2
  BUILD SUCCESSFUL
  Total time: 2.356 secs

```

Looks like I hit this: [http://issues.gradle.org/browse/GRADLE-160](http://issues.gradle.org/browse/GRADLE-160)

Or is this caused by the fact perhaps that my dependency is a ZIP, and not, say, a JAR?

---

<div class="post-metadata">

**Author:** ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)\
**Post date:** [November 4, 2012, 2:58am UTC](https://discuss.gradle.org/t/transitive-dependencies-with-non-java-code/7038/6 "2012-11-04T02:58:00Z")

</div>

Why are you still specifying an extension (’@zip’)? As I’ve tried to explain, this disables transitive dependency resolution.

---

<div class="post-metadata">

**Author:** ![Pinter\_Lorant](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/pinter_lorant/32/636_2.png) [@Pinter\_Lorant](https://discuss.gradle.org/u/Pinter_Lorant)\
**Post date:** [November 4, 2012, 3:14am UTC](https://discuss.gradle.org/t/transitive-dependencies-with-non-java-code/7038/7 "2012-11-04T03:14:00Z")

</div>

Sorry, missed that one. It makes sense, and now it works. Thanks for your help!

---

<div class="post-metadata">

**Author:** ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)\
**Post date:** [November 4, 2012, 3:20am UTC](https://discuss.gradle.org/t/transitive-dependencies-with-non-java-code/7038/8 "2012-11-04T03:20:00Z")

</div>

Glad to hear that it works.
