Test dependencies not keeped at test runtime ?

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

Test dependencies not keeped at test runtime ?

adryen31200
This post has NOT been accepted by the mailing list yet.
Hello all,

I have a mysterious problem,

When I run "gradle test" in my project I get a  "java.lang.NoClassDefFoundError: com/ebmwebsourcing/jbi/adaptor/impl/exchange/ContextualMessageExchangeFactoryImpl"
But this class is located in my "jbi-adapter-impl.jar", and is correctly added to the classpath, this following function correctly list my dependencies for "testRuntime" configuration

task listTestRuntime(dependsOn: configurations.testRuntime) << {
    configurations.testRuntime.files.each { file ->
    println file.name
    }
}

jbi-adapter-impl-1.0-SNAPSHOT-tests.jar
easycommons-logger-1.0-SNAPSHOT-tests.jar
petals-component-api-1.0-SNAPSHOT-tests.jar
jbi-adapter-impl-1.0-SNAPSHOT.jar


Do you have an idea, why ContextualMessageExchangeFactoryImpl class isn't found at the runtime of my test ?

Thank you,

Adrien RuffiƩ
Reply | Threaded
Open this post in threaded view
|

Re: Test dependencies not keeped at test runtime ?

Peter Niederwieser
adryen31200 wrote
Do you have an idea, why ContextualMessageExchangeFactoryImpl class isn't found at the runtime of my test ?
Have you checked if the class is actually contained in the Jar (jar -tf <jar filename> | grep <class name>)? Or maybe there is a class loader issue with your test.

--
Peter Niederwieser
Principal Engineer, Gradleware
http://gradleware.com
Creator, Spock Framework
http://spockframework.org
Twitter: @pniederw
Reply | Threaded
Open this post in threaded view
|

Re: Test dependencies not keeped at test runtime ?

adryen31200
This post has NOT been accepted by the mailing list yet.
I have check and my class is correctly added to jar archive, I think it's a classloader issue as you say, but classloader issues were already appear ?
Reply | Threaded
Open this post in threaded view
|

Re: Test dependencies not keeped at test runtime ?

adryen31200
This post has NOT been accepted by the mailing list yet.
aruffie@Latitude-046:~/.m2/repository/org/ow2/petals/jbi-adapter-impl/1.0-SNAPSHOT$ jar -tf jbi-adapter-impl-1.0-SNAPSHOT.jar | grep ContextualMessageExchangeFactoryImplcom/ebmwebsourcing/jbi/adaptor/impl/exchange/ContextualMessageExchangeFactoryImpl.class
Reply | Threaded
Open this post in threaded view
|

Re: Test dependencies not keeped at test runtime ?

adryen31200
This post has NOT been accepted by the mailing list yet.
I have another question, I have these following lines:

List testRuntimeJarList = ["org.ow2.petals:jbi-adapter-impl:1.0-SNAPSHOT@jar",
    "org.ow2.petals:petals-component-api:1.0-SNAPSHOT@jar",
    "junit:junit:4.8.2",
    "org.mockito:mockito-core:1.8.5",
                "com.ebmwebsourcing.easycommons:easycommons-logger@jar"]

List testRuntimeTestJarList = ["com.ebmwebsourcing.easycommons:easycommons-logger:1.0-SNAPSHOT:tests@jar"]

dependencies {
    testRuntime  testRuntimeJarList, testRuntimeTestJarList
}

Why when I had com.ebmwebsourcing.easycommons:easycommons-logger:1.0-SNAPSHOT:tests@jar dependency my com.ebmwebsourcing.easycommons:easycommons-logger jar isn't added and when I had just the com.ebmwebsourcing.easycommons:easycommons-logger jar without the test-jar is correctly added ?

Two previous dependencies overload each other ? How I can include the com.ebmwebsourcing.easycommons:easycommons-logger jar and test-jar together ?
Reply | Threaded
Open this post in threaded view
|

Re: Test dependencies not keeped at test runtime ?

Peter Niederwieser
adryen31200 wrote
Two previous dependencies overload each other ? How I can include the com.ebmwebsourcing.easycommons:easycommons-logger jar and test-jar together ?
You can't; it's a known issue. I recommend to use two different module names rather than different classifiers.

PS: For a new question, please start a new thread.

--
Peter Niederwieser
Principal Engineer, Gradleware
http://gradleware.com
Creator, Spock Framework
http://spockframework.org
Twitter: @pniederw
Reply | Threaded
Open this post in threaded view
|

Re: Test dependencies not keeped at test runtime ?

Peter Niederwieser
In reply to this post by adryen31200
adryen31200 wrote
I think it's a classloader issue as you say, but classloader issues were already appear ?
I don't understand what you are trying to say/ask.

--
Peter Niederwieser
Principal Engineer, Gradleware
http://gradleware.com
Creator, Spock Framework
http://spockframework.org
Twitter: @pniederw
Reply | Threaded
Open this post in threaded view
|

Re: Test dependencies not keeped at test runtime ?

adryen31200
Thank Peter for your help, but when you say two different module names you mean I should change:
"com.ebmwebsourcing.easycommons:easycommons-logger:1.0-SNAPSHOT:tests@jar" by
"com.ebmwebsourcing.easycommons:easycommons-logger-2:1.0-SNAPSHOT:tests@jar"
If I want to include "com.ebmwebsourcing.easycommons:easycommons-logger@jar" also ? for Example
Reply | Threaded
Open this post in threaded view
|

Re: Test dependencies not keeped at test runtime ?

Peter Niederwieser
I'm saying that instead of jbi-adapter-impl-1.0-SNAPSHOT.jar and jbi-adapter-impl-1.0-SNAPSHOT-tests.jar, you should produce jbi-adapter-impl-1.0-SNAPSHOT.jar and jbi-adapter-impl-tests-1.0-SNAPSHOT.jar. In other words, don't use classifiers but use different module names. Of course this is only an option if these are your own modules.

--
Peter Niederwieser
Principal Engineer, Gradleware
http://gradleware.com
Creator, Spock Framework
http://spockframework.org
Twitter: @pniederw

adryen31200 wrote
Thank Peter for your help, but when you say two different module names you mean I should change:
"com.ebmwebsourcing.easycommons:easycommons-logger:1.0-SNAPSHOT:tests@jar" by
"com.ebmwebsourcing.easycommons:easycommons-logger-2:1.0-SNAPSHOT:tests@jar"
If I want to include "com.ebmwebsourcing.easycommons:easycommons-logger@jar" also ? for Example
Reply | Threaded
Open this post in threaded view
|

Re: Test dependencies not keeped at test runtime ?

skunadi
This post has NOT been accepted by the mailing list yet.
In reply to this post by adryen31200
Is this issue resolved adryen???
Reply | Threaded
Open this post in threaded view
|

Re: Test dependencies not keeped at test runtime ?

Peter Niederwieser
This list is no longer active. Please use http://forums.gradle.org instead.