While it isn't mentioned explicitly, I suspect that 
myartifact-1.0.0-SNAPSHOT-test.jar only contains additional classes for testing 
purposes and is not a complete superset of myartifact-1.0.0-SNAPSHOT.jar.

Gradle is treating mygroup:myartifact as essentially a unique artifact 
identifier, and the classifier is just specifying the variant (like 
java14 or java6 such that logically they implement the "same" thing, but still
 have some important difference).


Because of that, _only_ myartifact-1.0.0-SNAPSHOT-tests.jar will be placed upon 
the classpath when tests are being run.  The testRuntime specification is 
overriding the compile specification of which mygroup:myartifact is desired at 
testRuntime.

If you published myartifact-tests-1.0.0-SNAPSHOT.jar as a separately named 
artifact, or had myartifact-1.0.0-SNAPSHOT-tests.jar include the test and core 
code, you should get the results that you desire.

-Spencer

--- On Fri, 4/22/11, Stephane Toussaint <[email protected]> wrote:

From: Stephane Toussaint <[email protected]>
Subject: [gradle-user] Build and Test problem with classifier usage
To: [email protected]
Date: Friday, April 22, 2011, 8:26 AM

Hi,

Maybe am I doing something wrong, but I'm facing a problem when using 
classifier.

A snap from my build.gradle :

dependencies {
    compile 'mygroup:myartifact:1.0.0-SNAPSHOT' // The jar package of my module
    testRuntime group: 'mygroup', name: 'myartifact', version: 
'1.0.0-SNAPSHOT', classifier: 'tests' // The test-jar package of my module
}

The myartifact module has been deployed as a jar and as a test-jar. When 
building my project under Intellij Idea. Everything fine. Compilation and Test 
are Ok.
When running ./gradlew build or test, there is test failure, due to 
java.lang.NoClassDefFoundError on a class within the jar package.

It seems that the test-jar package has the precedence on the jar package.

What am I doing wrong ?

Tested with 1.0-milestone-1 and 1.0-milestone-2

Thanks
Stephane
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to