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

Fix missing junit-platform-launcher version #4588

Conversation

DidierLoiseau
Copy link
Contributor

What's changed?

Use the JUnit BOM to specify the version of all JUnit dependencies.

Since rewrite-test uses JUnit as an api() dependency, this is done through api(platform(…)) instead of testImplementation(platform(…)).

What's your motivation?

I tried to build OpenRewrite on my Linux Desktop machine, and I kept getting the following error:

> Task :rewrite-java-17:compatibilityTest FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':rewrite-java-17:compatibilityTest'.
> Could not resolve all files for configuration ':rewrite-java-17:compatibilityTestRuntimeClasspath'.
   > Could not find org.junit.platform:junit-platform-launcher:.
     Required by:
         project :rewrite-java-17

(also with the other rewrite-java-* modules)

I don’t really understand why it works in other environments, but the thing is that the junit-platform-launcher version wasn’t specified anywhere.

JUnit documentation suggests using their BOM to align dependency versions. I thought it couldn’t hurt anyway, and this allows centralizing the version of JUnit (though I kept latest.release for now)

Anything in particular you'd like reviewers to focus on?

I am not very familiar with Gradle so better double check this 🙂

Have you considered any alternatives or workarounds?

This is the only solution I found but maybe I should have posted a question as well 😏

Checklist

  • I've added unit tests to cover both positive and negative cases – N/A
  • I've read and applied the recipe conventions and best practices – N/A
  • I've used the IntelliJ IDEA auto-formatter on affected files – actually I get different formatting if I do that on rewrite-java-8/build.gradle.kts

@DidierLoiseau DidierLoiseau force-pushed the fix/gradle-build-junit-platform-launcher branch from 34e256a to 7eb5ece Compare October 18, 2024 20:29
@timtebeek timtebeek self-requested a review October 20, 2024 10:00
@timtebeek timtebeek added bug Something isn't working enhancement New feature or request labels Oct 20, 2024
Copy link
Contributor

@timtebeek timtebeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks a lot! :)

@timtebeek timtebeek merged commit 88d422a into openrewrite:main Oct 20, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants