Build and Test problem with classifier usage

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Build and Test problem with classifier usage

Stephane Toussaint
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 | Threaded
Open this post in threaded view
|

Re: Build and Test problem with classifier usage

Spencer Allain
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 <[hidden email]> wrote:

From: Stephane Toussaint <[hidden email]>
Subject: [gradle-user] Build and Test problem with classifier usage
To: [hidden email]
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 | Threaded
Open this post in threaded view
|

Re: Build and Test problem with classifier usage

Szczepan Faber
In reply to this post by Stephane Toussaint

Hey

Might it be this issue: http://issues.gradle.org/browse/GRADLE-1442 ?

Cheers!
Szczepan

22-04-2011 14:27 użytkownik "Stephane Toussaint" <[hidden email]> napisał:
> 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 | Threaded
Open this post in threaded view
|

Re: Build and Test problem with classifier usage

Stephane Toussaint
In reply to this post by Spencer Allain
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 <[hidden email]> wrote:

From: Stephane Toussaint <[hidden email]>
Subject: [gradle-user] Build and Test problem with classifier usage
To: [hidden email]
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 | Threaded
Open this post in threaded view
|

Re: Build and Test problem with classifier usage

Stephane Toussaint
In reply to this post by Szczepan Faber
Yes, It seems to be related. Note the answer of Spencer.
Now Someone has to say if it is really a bug.

Cheers
Stephane

Le 22 avr. 2011 à 15:38, Szczepan Faber a écrit :

Hey

Might it be this issue: http://issues.gradle.org/browse/GRADLE-1442 ?

Cheers!
Szczepan

22-04-2011 14:27 użytkownik "Stephane Toussaint" <[hidden email]> napisał:
> 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 | Threaded
Open this post in threaded view
|

ANN: Gradle wikipedia page

Spencer Allain
Ok, it's only in English at the moment and it's very sparse, but I've thrown something up for Gradle onto wikipedia.

http://en.wikipedia.org/wiki/Gradle

It could certainly disappear without a moments notice by one of the administrators of Wikipedia as it might not be considered "worthy", but hopefully it's in a good enough state that others can contribute to it.

-Spencer

Reply | Threaded
Open this post in threaded view
|

Re: ANN: Gradle wikipedia page

Ken Sipe
Fantastic! +1 Spencer



On Apr 22, 2011, at 2:07 PM, Spencer Allain wrote:

Ok, it's only in English at the moment and it's very sparse, but I've thrown something up for Gradle onto wikipedia.

http://en.wikipedia.org/wiki/Gradle

It could certainly disappear without a moments notice by one of the administrators of Wikipedia as it might not be considered "worthy", but hopefully it's in a good enough state that others can contribute to it.

-Spencer


Reply | Threaded
Open this post in threaded view
|

Re: ANN: Gradle wikipedia page

Philippe Lhoste
In reply to this post by Spencer Allain
On 22/04/2011 21:07, Spencer Allain wrote:
> Ok, it's only in English at the moment and it's very sparse, but I've
> thrown something up for Gradle onto wikipedia.
>
> http://en.wikipedia.org/wiki/Gradle
>
> It could certainly disappear without a moments notice by one of the
> administrators of Wikipedia as it might not be considered "worthy", but
> hopefully it's in a good enough state that others can contribute to it.

Good! And indeed, some programming languages were removed (or their
status is pending) because of "lack of notoriety". But Gradle case is
different, it is now already famous.

Side note: don't answer a random message to post to a mailing list, make
a new message and fill in the address.
Why? Because your message is now in the middle of a an unrelated thread,
so lot of people will not notice it if they only look at the top-level
of threads.
Your announcement is worth being at top level... :-)

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --


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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Build and Test problem with classifier usage

Peter Niederwieser
In reply to this post by Stephane Toussaint
Stephane Toussaint wrote
We where doing this way with maven build. Is there a chance the same feature will be applied in a future version of gradle ?
Gradle uses Ivy for dependency solution. Ivy doesn't always behave exactly like Maven. Probably you have hit such a case.

--
Peter Niederwieser 
Developer, Gradle
http://www.gradle.org
Trainer & Consultant, Gradleware
http://www.gradleware.com
Creator, Spock Framework
http://spockframework.org