Skip to content
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

dependency conflicts showing in gradle #318

Open
swalton00 opened this issue Feb 24, 2022 · 4 comments
Open

dependency conflicts showing in gradle #318

swalton00 opened this issue Feb 24, 2022 · 4 comments

Comments

@swalton00
Copy link

A clean project (after modifications to allow for Java 11) shows dependency problems with either JDK8 or 11:

Execution failed for task ':dependencies'.

Could not resolve all dependencies for configuration ':testCompileClasspath'.
Conflict(s) found for the following module(s):
- org.codehaus.groovy:groovy between versions 2.5.14 and 2.5.12
- org.objenesis:objenesis between versions 3.2 and 2.6
- junit:junit between versions 4.13.2, 4.3.1 and 4.5
- org.easytesting:fest-util between versions 1.1.3 and 1.1
Run with:
--scan or
:dependencyInsight --configuration testCompileClasspath --dependency org.codehaus.groovy:groovy
to get more insight on how to solve the conflict.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

when run with dependencyInsight:

junit:junit:4.13.2
variant "compile" [
org.gradle.status = release (not requested)
org.gradle.usage = java-api
org.gradle.libraryelements = jar (compatible with: classes+resources)
org.gradle.category = library

  Requested attributes not found in the selected variant:
     org.gradle.dependency.bundling = external
     org.gradle.jvm.version         = 8

]
Selection reasons:
- By conflict resolution : between versions 4.13.2, 4.3.1 and 4.5

junit:junit:4.13.2
--- org.codehaus.griffon:griffon-core-test:2.16.0
+--- testCompileClasspath
--- org.codehaus.griffon:griffon-fest-test:2.16.0
--- testCompileClasspath

junit:junit:4.3.1 -> 4.13.2
--- org.easytesting:fest-swing-junit:1.2.1
+--- org.codehaus.griffon:griffon-fest-test:2.16.0
| --- testCompileClasspath
--- org.easytesting:fest-swing-junit-4.5:1.2.1
--- org.codehaus.griffon:griffon-fest-test:2.16.0 (*)

junit:junit:4.5 -> 4.13.2
--- org.easytesting:fest-swing-junit-4.5:1.2.1
--- org.codehaus.griffon:griffon-fest-test:2.16.0
--- testCompileClasspath

org.junit:junit-bom:5.7.2
variant "platform-compile" [
org.gradle.status = release (not requested)
org.gradle.usage = java-api
org.gradle.category = platform

  Requested attributes not found in the selected variant:
     org.gradle.dependency.bundling = external
     org.gradle.libraryelements     = classes+resources
     org.gradle.jvm.version         = 8

]

org.junit:junit-bom:5.7.2
+--- org.junit.platform:junit-platform-commons:1.7.2
| +--- org.junit.platform:junit-platform-engine:1.7.2
| | +--- org.spockframework:spock-core:2.0-groovy-2.5 (requested org.junit.platform:junit-platform-engine)
| | | --- testCompileClasspath
| | +--- org.junit.platform:junit-platform-launcher:1.7.2
| | | +--- org.junit.platform:junit-platform-testkit:1.7.2
| | | | +--- org.spockframework:spock-core:2.0-groovy-2.5 (requested org.junit.platform:junit-platform-testkit) ()
| | | | --- org.junit:junit-bom:5.7.2 (
)
| | | --- org.junit:junit-bom:5.7.2 ()
| | --- org.junit:junit-bom:5.7.2 (
)
| --- org.junit:junit-bom:5.7.2 ()
+--- org.junit.platform:junit-platform-engine:1.7.2 (
)
+--- org.junit.platform:junit-platform-launcher:1.7.2 ()
+--- org.junit.platform:junit-platform-testkit:1.7.2 (
)
+--- org.spockframework:spock-core:2.0-groovy-2.5 ()
--- org.spockframework:spock-groovy2-compat:2.0-groovy-2.5
--- org.spockframework:spock-core:2.0-groovy-2.5 (
)

(*) - dependencies omitted (listed previously)

Can you suggest the best resolution?

@aalmiray
Copy link
Member

I'd suggest using the standard Gradle mechanism for selecting/forcing a particular dependency version.

To be honest I have not been keeping up with Gradle since they upgraded their dependency management mechanism in early 6. I prefer to use the enforcer-gradle-plugjn and the ForceDependencies rule to achieve the same goal https://kordamp.org/enforcer-gradle-plugin/#_forcedependencies

Be aware that forcing dependencies in this way is frowned upon by the Gradle team, thus your 1st option should be to find out how Gradle 6.x or 7.x prefers to handle dependency conflicts.

@swalton00
Copy link
Author

Looks like a better option might be switch to maven. What I am trying to accomplish is to upgrade an existing project from Griffon 2.15.0 to 2.16.0 and along the way switch from Groovy to Java and from JavaFX to Swing. The reason is that Java post 1.8 has become much more difficult for novices to navigate unless they are pure Java (Groovy has all those nasty looking reflection mechanisms, and JavaFX has become tricky to setup, partly because it no longer comes as part of Java).

I can correctly build my project with Maven (but only as a seperate entity). But Griffon is only a sub-part of my project (another part is AsciiDoc, provinding the help screens and documentation). As a Gradle project it was easy to set up a project structure with the Griffon sub-part. Doing the same in Griffon is much more difficult. Setting the parent-pom for griffon is something I'm not sure how to do correctly.

@swalton00
Copy link
Author

That did not work:
08:24:40.922 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
08:24:40.922 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
08:24:40.922 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
08:24:40.922 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Where:
08:24:40.922 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Build file 'D:\Projects\rewrite_RR\RRTools\rrtools\build.gradle' line: 19
08:24:40.922 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
08:24:40.922 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
08:24:40.922 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] A problem occurred evaluating root project 'rrtools'.
08:24:40.923 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Failed to apply plugin [id 'org.kordamp.gradle.enforcer']
08:24:40.923 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > class org.gradle.api.internal.project.DefaultProject_Decorated cannot be cast to class org.gradle.api.initialization.Settings (org.gradle.api.internal.project.DefaultProject_Decorated and org.gradle.api.initialization.Settings are in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader @224edc67)
08:24:40.923 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
08:24:40.923 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try:
08:24:40.923 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Run with --stacktrace option to get the stack trace. Run with --scan to get full insights.
08:24:40.923 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]

@aalmiray
Copy link
Member

You must apply the enforcer plugin on settings.gradle or the project-enforcer plugin in build.gradle https://kordamp.org/enforcer-gradle-plugin/#_applying_the_plugin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants