Gradle 3 buildscript classpath


(Bisiarin) #1

Greetings to everyone,
I’m trying to move plugins project from 2.13 to 3m1 and build fails, because it can’t find for instance commons-codec library. It is fixed, of course, by adding additional dependencies, but in 2.13 that was unnecessary, as probably these libs were placed in %GRADLE_HOME%/lib folder, I guess. So the question is, whether my anticipations are right, or not and if it is, why it was excluded from buildscript classpath?


(Pepper Lebeck-Jobe) #2

George,

First, can you be sure that this is still a problem for Gradle 3.0 which was released on Monday? Also, could you provide more information about exactly what you’re trying to do? Do you have a public project we could take a look at on GitHub or a reproducible test case which fails with 3.0 and passes with 2.13? I’m going to move this discussion over to the Help category (and probably close this 3.0 M1 Feedback category.)

Thanks,
Pepper


(Bisiarin) #3

I just imported in source code org.apache.commons.codec.language.bm.* the list of dependencies is:
dependencies {
compile gradleApi()

    testCompile gradleTestKit()
    testCompile group: 'junit', name: 'junit', version: '4.10'
    testCompile group: 'org.spockframework', name: 'spock-core', version: '1.1-groovy-2.4-rc-1', transitive: false
}

Build fails, cause
:plugins:compileGroovy startup failed: D:\workspace\plugins\src\main\groovy\CustomPlugin.groovy: 5: unable to resolve class org.apache.commons.codec.language.bm.Languages.SomeLanguages @ line 5, column 1. import org.apache.commons.codec.language.bm.*;
In 2.13 it works fine


(Benjamin Muschko) #4

The behavior you are seeing was introduced with Gradle 2.14. Starting with version 2.14, Gradle core’s external dependencies (the ones that are bundled with Gradle in the lib directory of the distribution) have been shaded and will not be available to your project’s dependencies anymore when declaring a dependency on gradleApi(). Please see the release notes for more information.

You will need to explicitly declare a dependency on Commons Codec in your project.