Gradle classifiers

(Josiah Haswell) #1

Hi folks,

I have the following configuration:

 configurations {
       published.extendsFrom tests, archives
       dependencies {
       compile compileDependencies
       testCompile testDependencies
       clover 'com.cenqua.clover:clover:3.1.2'
   task testArchive(type: Jar, dependsOn: testClasses) {
       classifier = "tests"
       from sourceSets.test.output
   artifacts {
       archives testArchive
       tests testArchive
     install {
       configuration = configurations.published

for a project:

group: com.mytest
 artifact: test-project
 version: 1.0.0-SNAPSHOT

Running “gradle clean install” generates the following artifacts in my repository:


which looks correct.

When I declare a dependency on those coordinates from another project as follows:

testCompile group: "com.mytest", name: "test-project", version:"1.0.0-SNAPSHOT", classifier: "tests"

I get the following output:

Could not resolve all dependencies for configuration ':otherproject'.
 Artifact 'com.mytest:test-project:1.0.0-SNAPSHOT:tests@jar' not found.

I notice that the Maven metadata for test-project doesn’t contain all of the same data that it does when the project is

built by Maven, but even builing and deploying test-project doesn’t make fix the problem. I’ve tried other formats like:

testCompile "com.mytest:test-project:1.0.0-SNAPSHOT:tests"

to no avail. Am I missing something obvious?

I’m running Gradle 1.4 on JDK 1.7 on Mac OSX



(Luke Daley) #2

Hi Joe,

Dependencies between projects are different in Gradle. The following previous post should help you out:

(Jordan Black) #3

I’m having a similar issue.

testCompile group: ‘’, name: ‘’, version:‘7-SNAPSHOT’, classifier:‘standalone’

gives this error:

Could not find

Required by:


Although I have verified that the file ‘’ exists in my local m2 repository at directory \org\apache\sling\\7-SNAPSHOT.

(Peter Niederwieser) #4

Make sure that you have a ‘mavenLocal()’ repository declared. If that doesn’t help, try with the latest Gradle version, as handling of Maven local has recently been improved. I don’t think your problem is caused by the classifier.

(Jordan Black) #5

Yea, I had mavenLocal() declared in my repositories, but it wasn’t working. I had to actually include the file path to my local repo to get it to work. But yea, it wasn’t related to the classifier.