groovy - My Gradle project depends on commons-io 2.4, but Gradle puts $GRADLE_HOME/commons-io-1.4.jar into the classpath, causing failures -
i've been iterating on features in first gradle plugin. determined on needed commons-io, added dependency on commons-io 2.4, being latest version.
this has been going while, build working command line, , no errors in eclipse.
i started trying integrate code uses "fileutils.write(file,string)". didn't need method before. got un-redded in eclipse, , tried command line build.
this failed errors following:
... error: cannot find symbol fileutils.write(serviceloaderfile, ^ symbol: method write(file,string) location: class fileutils this confused me. went failing lines in eclipse, , no issues indicated. navigated "write()" method, , looked fine me. ran command-line build "--debug" clues.
when found "javac" line, found "$gradle_home\lib\commons-io-1.4.jar" (where "gradle_home" gradle 2.3 distribution) in classpath before dependency jar. inspected code in 1.4 jar, , determined "fileutils" class in version didn't have "write" method.
what supposed this?
update:
i suppose it's "dependencies" block useful, this:
dependencies { compile ("org.codehaus.groovy:groovy-all:2.3.9") compile gradleapi() compile "org.opendaylight.yangtools:yang-parser-impl:0.7.0-snapshot" compile "org.opendaylight.yangtools:binding-java-api-generator:0.7.0-snapshot" compile "org.opendaylight.yangtools:binding-generator-api:0.7.0-snapshot" compile "org.opendaylight.yangtools:binding-generator-impl:0.7.0-snapshot" compile "org.opendaylight.controller:yang-jmx-generator:0.3.0-snapshot" compile "commons-io:commons-io:2.4" testcompile("org.spockframework:spock-core:1.0-groovy-2.3") { exclude group: "org.codehaus.groovy" } i tried commenting out "gradleapi" reference, , had no effect. tried adding "exclude" commons-io associated "groovy-all" reference, didn't appear make difference. }
you added gradleapi() under dependencies {} block - see docs. problem ships dependencies gradle requires - including commons-io in version 1.4 - see extract below:
[opal@opal-mac-2]~/.gvm/gradle/current/lib % pwd /users/opal/.gvm/gradle/current/lib [opal@opal-mac-2]~/.gvm/gradle/current/lib % ll commons-io-1.4.jar -rw-rw-r-- 1 opal staff 109043 23 gru 13:17 commons-io-1.4.jar [opal@opal-mac-2]~/.gvm/gradle/current/lib % you added version 2.4 separately , that's why conflict occurred. can run
gradle dependencies to view full dependency tree , verify problem.
there's no possibility exclude transitive dependency gradleapi().
Comments
Post a Comment