Spencer,

Ok, I understand, this is what I suspected. And you're right, the test-jar package only contains classes from the test source so that another module test may inherit of it or use some common mock.
We where doing this way with maven build. Is there a chance the same feature will be applied in a future version of gradle ?

In any case, I will see if changes may be done on this particular artifact deployment.

Thank you for your help

Stephane

Le 22 avr. 2011 à 15:29, Spencer Allain a écrit :

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




Stéphane TOUSSAINT
XMS Technical Product Leader
Tel : 01.61.08.50.30
Std : 01.61.08.50.20
Fax : 01.61.38.24.41

Reply via email to