Search code examples
javaunit-testingmavendependenciesgradle

How Do I Pull Maven Test Jars Using Gradle?


In maven I can specify a "type" for dependency resolution. I am trying to pull down a tests.jar. How can I do this using Gradle?

I have tried using the Gradle Dependency below, but this does not pull down test.jar.

testCompile(group: 'org.apache.hbase', name: 'hbase', version: '0.94.2', type: 'test-jar')

Maven Dependency:

<dependency>
    <groupId>org.apache.hbase</groupId>
    <artifactId>hbase</artifactId>
    <version>0.94.2</version>
    <type>test-jar</type>
    <scope>test</scope>
</dependency>

details: Gradle 1.7

I am trying to pull down "hbase-0.94.2-tests.jar" from Maven Central


Solution

  • Gradle doesn't have a direct equivalent of Maven's <type>, but classifier: 'tests' should work here (instead of type: ...).