Add hidden sbt key for extra JUnit template library dependencies #SCL-25373 - #148
Merged
Vasil Vasilev (vasilmkd) merged 4 commits intoApr 29, 2026
Merged
Conversation
…-25373 Introduce intellijExtraJUnitTemplateLibraryDependencies, a hidden settingKey[Seq[ModuleID]] whose modules are resolved through a dedicated hidden Ivy configuration and appended only to the JUnit Run Configuration template classpath. The sbt Test classpath is intentionally unaffected, so libraries needed at test runtime when launched from the IDE can be declared without polluting in-sbt test runs. Covered by a new integration test that asserts the resolved jar appears in the generated junit_template_argfile.txt and is absent from Test/fullClasspath. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
actions/checkout v4 -> v6 actions/setup-java v4 -> v5 coursier/cache-action v6 -> v8 sbt/setup-sbt is already at the latest major (v1). Existing inputs are unchanged across these majors, so no further configuration edits are needed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
sbt-ci-release 1.11.1 -> 1.11.2 sbt-ide-settings 1.1.2 -> 1.1.4 Verified via sbt reload. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1.11.5 -> 1.12.10. Verified via sbt reload. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Vasil Vasilev (vasilmkd)
deleted the
scl-25373-junit-template-library-deps
branch
April 29, 2026 12:09
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Introduces a new hidden setting key,
intellijExtraJUnitTemplateLibraryDependencies: SettingKey[Seq[ModuleID]], that lets a consuming build add library dependencies that should appear only on the JUnitRun Configuration template classpath generated during IDEA project import — not on the sbt
Test / fullClasspath.Motivation: when tests are launched from the IDE, some libraries are needed at runtime that are otherwise satisfied differently during in-sbt test runs (e.g. provided by the IntelliJ instance or by an
upstream module). Until now there was no way to express "extra JAR for the IDE-launched test JVM only" without polluting
Test / fullClasspath.Implementation
settingKey[Seq[ModuleID]]intellijExtraJUnitTemplateLibraryDependencies(Keys.scala), hidden viaKeyRanks.Invisible— settable frombuild.sbtbut not surfaced in tab-completion /taskslistings.
private[sbtidea]IvyConfigurationintellijJUnitTemplateConfig(hidden, no parents). The key's modules are routed into this configuration vialibraryDependencies ++= … .map(_ % intellijJUnitTemplateConfig)inInit.scala, so they participate in normalupdateresolution but do not leak intoCompile/Test.TestClasspathTasks.fullTestClasspathForJUnitTemplatenow appendsClasspaths.managedJars(intellijJUnitTemplateConfig, classpathTypes.value, update.value)to the template classpath.fullTestClasspathForSbtis intentionally untouched.Test plan
intellijExtraJUnitTemplateLibraryDependencies appears only on the JUnit template classpathinSbtIdeaPluginIntegrationTest.scala. It:intellijExtraJUnitTemplateLibraryDependencies += "commons-io" % "commons-io" % "2.16.1"against thesimple-with-pluginfixture,createIDEARunConfigurationand assertscommons-io-2.16.1.jaris present in the generated.idea/runConfigurations/junit_template_argfile.txt,show Test/fullClasspathand asserts the same jar is absent from the captured stdout.publishLocalagainst the Scala Plugin repo.