<@U0QBCLV62> I'm getting tons of errors trying to ...
# gradle
j
@bamboo I'm getting tons of errors trying to upgrade a project to Gradle
4.1
from
4.0.2
. Mostly related to dependency configurations missing like
testCompile
.
a
same answer as for me
j
So I have this:
Copy code
subprojects {
    apply {
        plugin("java")
        plugin("checkstyle")
        plugin("pmd")
        plugin("findbugs")
        plugin("jacoco")
    }
    repositories {
        mavenCentral()
    }

    dependencies {
        testCompile(group = "junit", name = "junit", version = "+")
    }
}
Shouldn't
testCompile
be correctly resolved?
a
nop, you are applying java plugin to subprojects
so in this project/script testCompile doesnt exist
j
Thats what I want. I don't want it on the parent. But I want to be able to configure all the subprojects's
dependencies
.
@bamboo This is a pretty big blocker for me.
You should be able to configure subproject's dependencies even if that project doesn't have the
java
plugin applied to it.
a
i guess allprojects instead of subprojects will fix it, but that's not what you want
b
The quick workaround is to use strings instead
“testCompile”(...)
right
j
The impact of this is that my
4.0.2
build file will be 100% incompatible with
4.1
. Which, while I understand that GSK is in pre-release and subject to API changes, not the kind of massive build refactor that I want to have to go through.
b
Our rationale for the change is to provide better static checking with the understanding that this also makes certain usages less convenient
You should be able to provide a
testCompile
accessor on
buildSrc
it will be available to every project
j
As a user that's been working with GSK for months now I'd personally much rather get Gradle throwing a
"Configuration not found in project"
error over not having the static method there. I mean sure, I can add it, but I'm working with GSK on several different projects, I don't really want to have to do that for each
buildSrc
. I mean I will if I have to.
b
The good news is that configurations that were previously unaccessible will now be accessible (think
api
,
implementation
and any custom configuration created by plugins out there)
j
For the
buildSrc
you'd just put the extension in the root package so that all projects can access it? So, the assumption that I'm working off of is that every project that is working with the
dependency
block will always have the
testCompile
and will almost always want to use it.
b
Another solution would be to provide those accessors in a library and then add the library as a
buildSrc
dependency
The library can then be reused in other projects
root package should do
j
Okay, I can work with it for now. But consider my complaint officially filed 😛 Other than that the new feature with the dynamic generation seems nice. It would be nice if I could do:
Copy code
"testCompile"(group = "junit", name = "junit", version = "+")
Instead of:
Copy code
"testCompile"(create(group = "junit", name = "junit", version = "+"))
b
Ack 🙂
And yes, that should work, we have an issue for that already
m
I think https://github.com/gradle/kotlin-dsl/issues/291 may be the one you are referring to, I am hoping to take some time out the next week to help with a few of these!
b
Yes, @mkobit, that’s the one, thanks!