-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot change dependencies of dependency configuration 'foo' #423
Comments
As a follow up, this appears to be related to an interaction between this plugin and the gradle-kotlin one. Further, it seems that, if the dependencies between modules in a build follow a strict alphabetic order (b can depend on a, but not vice versa), it works! |
Interesting! We've actually seen this internally as well, but didn't investigate yet since we don't use kotlin very widely. For some context on the GCV side, we do some sketchy copying of the entire dependency graph (at least starting from the roots that end up being locked, usually the I think this issue could occur if the kotlin plugin somehow causes one of these java configurations to be resolved instead of the fake GCV one during GCV's lock file computation. |
Found your culprit, it's actually different from what I thought. Kotlin is trying to realize the dependency constraints on some of the java configurations at configuration-time, which GCV doesn't like because it later tries to add some lazy constraints of its own which involve resolving compileClasspath / runtimeClasspath, and so they should only be realized at task execution time.
|
Doing some more investigation, it looks like these lines of code should use some form of [1]: Note that addAllLater + ListProperty doesn't work unless you use this hack in Gradle < 6.0 Edit: PR showcasing how I got to the kotlin stacktrace: #424 |
What happened?
We're trialling the use of the consistent versions plugin on our project, and when it works, it works brillantly. However, with certain combinations of multi project gradle builds, we get an exception when trying to build the project. Whether or not the exception happens appear to be dependent on the specific set of modules and their naming - it's possible that it is triggered by some internal iteration order of modules.
When running a
./gradlew clean build
at the root of a multi module gradle build containing dependencies between the modules themselves, the build fails withCaused by: org.gradle.api.InvalidUserDataException: Cannot change dependencies of dependency configuration ':<redacted>:apiElements' after it has been included in dependency resolution.
(see full stack trace below).This happens under gradle 6.1, consistent versions plugin 0.17.2, and a Java 11 runtime (though it seems to fail also with other combinatins).
What did you want to happen?
For the gradle build to work.
Full stack trace of error:
The text was updated successfully, but these errors were encountered: