2

I'm in situation similar with this (bug between JodaTime and versions of Java greater then 1.8u60).

So what I need is:

  1. Upgrading to JodaTime version 2.8.1 or later.
  2. The problem is: JodaTime is a transitive dependency in my project.

Build automation tool used in it is gradle. Need help to handle it.

buildscript:

buildscript {
    ext {
        springBootVersion = '1.2.4.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 
        classpath("io.spring.gradle:dependency-management-plugin:0.5.1.RELEASE")
        classpath("org.flywaydb:flyway-gradle-plugin:3.2.1")
    }
}

apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'spring-boot' 
apply plugin: 'io.spring.dependency-management' 
apply plugin: 'org.flywaydb.flyway'

jar {
    baseName = 'xxxx'
    version = 'alpha'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {

    compile("org.springframework.boot:spring-boot-starter-data-jpa:1.2.4.RELEASE")
    compile("org.springframework.boot:spring-boot-starter-aop:1.2.4.RELEASE")
    compile("org.springframework.boot:spring-boot-starter-web:1.2.4.RELEASE")
    compile("org.springframework.boot:spring-boot-starter-freemarker:1.2.4.RELEASE")
    compile("com.amazonaws:aws-java-sdk:1.10.2")
    compile("com.stripe:stripe-java:1.33.0")
    compile("org.flywaydb:flyway-core:3.2.1")
    compile("com.jolbox:bonecp:0.8.0.RELEASE")

    runtime("org.postgresql:postgresql:9.4-1201-jdbc41")

    testCompile("org.springframework.boot:spring-boot-starter-test:1.2.4.RELEASE")
}

dependencyManagement {
    imports { 
        mavenBom "org.springframework.cloud:spring-cloud-starter-parent:1.0.2.RELEASE" 
    }
}

eclipse {
    classpath {
         containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER')
         containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8'
    }
}

task wrapper(type: Wrapper) {
    gradleVersion = '2.3'
}
Community
  • 1
  • 1
Alex Silkovsky
  • 541
  • 5
  • 18

2 Answers2

3

You need to change the following piece of code in dependencies block:

compile("com.amazonaws:aws-java-sdk:1.10.2") {
     exclude group: 'joda-time', module: 'joda-time'
}
compile("joda-time:joda-time:2.8.1")
Opal
  • 81,889
  • 28
  • 189
  • 210
0

put transitive false, and set between your dependencies the packages that you need rather that the ones in the transitive download.

mautrok
  • 961
  • 1
  • 17
  • 41
  • This way you will exclude *all* the transitive dependencies of a given dependency - this is not always what you want/need. – Opal Aug 26 '15 at 12:24