Skip to content

Derive junit-platform-launcher and junit5Version from sbt-jupiter-interface plugin#1015

Merged
pjfanning merged 5 commits into
apache:mainfrom
pjfanning:copilot/remove-hard-coded-junit-version
Apr 16, 2026
Merged

Derive junit-platform-launcher and junit5Version from sbt-jupiter-interface plugin#1015
pjfanning merged 5 commits into
apache:mainfrom
pjfanning:copilot/remove-hard-coded-junit-version

Conversation

@pjfanning
Copy link
Copy Markdown
Member

@pjfanning pjfanning commented Apr 15, 2026

Summary

Removes the hardcoded version numbers for junit-platform-launcher and junit5Version from project/Dependencies.scala. Instead, both are now derived at build time via the SettingKeys that the sbt-jupiter-interface plugin already exposes — ensuring they always stay in sync with the plugin.

Deprecates Junit 4 supporting classes.

Changes

project/Dependencies.scala

  • Import JupiterKeys from com.github.sbt.junit.jupiter.sbt.Import (available on the meta-build classpath via addSbtPlugin)
  • Add lazy val junit5TestDeps: Def.Initialize[Seq[ModuleID]] = Def.setting { ... } that reads versions from the plugin's own SettingKeys: JupiterKeys.jupiterVersion, JupiterKeys.junitJupiterVersion, and JupiterKeys.junitPlatformVersion
  • Replace old net.aichler:jupiter-interface:0.11.1 with com.github.sbt.junit:jupiter-interface (current artifact coordinates), version also derived from the plugin
  • Update all subproject dependency settings (httpCore, http2Tests, httpTestkit, httpTests, httpJackson, httpJackson3, docs) to use libraryDependencies ++= junit5TestDeps.value

How it works

JupiterPlugin exposes the JUnit versions it was built against as SBT SettingKeys (see JupiterPlugin.scala line 37):

junitPlatformVersion := readResourceProperty("jupiter-interface.properties", "junit.platform.version"),
junitJupiterVersion  := readResourceProperty("jupiter-interface.properties", "junit.jupiter.version"),
jupiterVersion       := readResourceProperty("jupiter-interface.properties", "version"),

Since the plugin is on the meta-build classpath, project/Dependencies.scala can import JupiterKeys and use those settings directly inside a Def.setting { } block — the same way SBT's own setting graph works — rather than duplicating the resource-reading logic.

Copilot AI and others added 2 commits April 15, 2026 21:12
…erface plugin

Co-authored-by: pjfanning <11783444+pjfanning@users.noreply.github.com>
…ive junit5/platform versions

Agent-Logs-Url: https://github.com/pjfanning/incubator-pekko-http/sessions/905fa9e4-bc31-4606-bf9c-78250a2e4716

Co-authored-by: pjfanning <11783444+pjfanning@users.noreply.github.com>
@pjfanning pjfanning force-pushed the copilot/remove-hard-coded-junit-version branch from 8860bd6 to 7216505 Compare April 15, 2026 19:12
@pjfanning pjfanning merged commit c06470b into apache:main Apr 16, 2026
5 checks passed
@pjfanning pjfanning deleted the copilot/remove-hard-coded-junit-version branch April 16, 2026 20:18
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.

3 participants