Skip to content

Fix: Correctly detect Scala version defined in maven-scala-plugin configuration#134

Merged
tgodzik merged 1 commit into
scalacenter:mainfrom
krrish175-byte:fix/issue-84-stuck-scala-version-clean
Jan 19, 2026
Merged

Fix: Correctly detect Scala version defined in maven-scala-plugin configuration#134
tgodzik merged 1 commit into
scalacenter:mainfrom
krrish175-byte:fix/issue-84-stuck-scala-version-clean

Conversation

@krrish175-byte

Copy link
Copy Markdown
Contributor

Problem:

The bloop-maven-plugin failed to detect scalaVersion or scalaCompatVersion if these were defined within an <execution> block of the scala-maven-plugin (a common configuration pattern), causing it to fall back to the Scala version of the project's dependencies (e.g., sticking to 3.2.2 even if 3.4.2 was configured).

Solution:

Updated MojoImplementation.scala to inspect not only the top-level plugin configuration but also all <execution> configurations. These configurations are merged (Execution config > Plugin config) to ensure the specific execution settings are respected.

Verification:

Added a regression test issue84 in MavenConfigGenerationTest.scala which reproduces the issue using a test project (issue_84/pom.xml) that defines the Scala version only in an execution block. The test passes and confirms the correct version (3.4.2) is detected.

Fixing issue:

fixes #84

@tgodzik

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This pull request fixes a bug where the bloop-maven-plugin failed to detect the Scala version when it was defined within an <execution> block of the scala-maven-plugin configuration, rather than at the plugin level.

Changes:

  • Updated MojoImplementation.scala to inspect and merge both execution-level and plugin-level configurations when detecting Scala settings
  • Added regression test issue84 to verify the fix works correctly for the reported scenario
  • Added test resource issue_84/pom.xml that reproduces the original issue

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/main/scala/bloop/integrations/maven/MojoImplementation.scala Modified configuration extraction logic to merge execution and plugin configurations, ensuring execution-level settings take precedence
src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala Added test case to verify Scala version is correctly detected from execution configuration
src/test/resources/issue_84/pom.xml Added test project with Scala version defined only in execution block to reproduce the reported issue

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@krrish175-byte

Copy link
Copy Markdown
Contributor Author

hey @tgodzik any updates on this?

@tgodzik tgodzik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, looks good!

@tgodzik tgodzik merged commit 40d7a17 into scalacenter:main Jan 19, 2026
10 checks passed
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

Successfully merging this pull request may close these issues.

Stuck at Scala version 3.2.2

3 participants