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',
    runtime "org.constretto:constretto-core:${constrettoVersion}",
    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