Why my gradle build is using the wrong joda-time version lib?


(Matteo Barbieri) #1

Hi, my dependencies are:

dependencies {
compile 'joda-time:joda-time:2.1',
            "org.constretto:constretto-api:${constrettoVersion}",
            "org.constretto:constretto-spring:${constrettoVersion}",
            "org.springframework:spring:${springVersion}",
            'cglib:cglib-nodep:2.1_3',
            'com.google.guava:guava:11.0.1',
            'com.googlecode.lambdaj:lambdaj:2.3.3',
            'org.hibernate:hibernate-core:3.3.2.GA',
            'org.hibernate:hibernate-entitymanager:3.3.2.GA',
            'org.hibernate:hibernate-annotations:3.3.1.GA',
            'org.hibernate:hibernate-commons-annotations:3.3.0.ga',
            'commons-collections:commons-collections:3.2.1',
            'commons-beanutils:commons-beanutils:1.8.3'
    runtime "org.constretto:constretto-core:${constrettoVersion}",
            "org.aspectj:aspectjweaver:1.6.6"
    ajc "org.aspectj:aspectjtools:1.6.6"

When I run my tests in IntelliJ (libs imported using ‘gradle idea’) everything is working fine, but from the ‘gradle test’ command I got some compilation error that suggests me it’s using a different joda-time version, since there are some constructor missing in older versions, checking joda-time javadocs I see that they are available from version 2.

I checked all my dependencies with ‘project-reports’ plugin, and I have only one joda-time version (2.1, the correct one). I removed all gradle, ivy and maven caches (in ~/.gradle ~/.ivy and ~/.m2) but I got the same error. What else can I check? What am I doing wrong? Thank you, bye


(Peter Niederwieser) #2

Check the test task’s class path:

task showTestTaskClasspath << {
  test.classpath.each { println it }
}

(Matteo Barbieri) #3

Ok, I just found that I had jruby.jar in my classpath and it uses an older joda-time version… Thank you very much for your help. Bye