Skip to content

Use systemPath for system-scoped dependencies instead of remote resolution (#27) - #148

Merged
tgodzik merged 1 commit into
scalacenter:mainfrom
jozanek:fix/issue-27-system-scope-dependencies
Jun 16, 2026
Merged

Use systemPath for system-scoped dependencies instead of remote resolution (#27)#148
tgodzik merged 1 commit into
scalacenter:mainfrom
jozanek:fix/issue-27-system-scope-dependencies

Conversation

@jozanek

@jozanek jozanek commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Fixes #27

Problem

When a dependency has <scope>system</scope> (with a <systemPath>), the plugin tried to resolve it from remote Maven repositories. Since system-scoped jars live on the local filesystem and aren't published to any repo, this produced spurious Downloading from central: … attempts and [ERROR] FAILURE …:system / Could not resolve …:system log lines — the symptom reported in #27 (e.g. jdk.tools:jdk.tools:1.8 pulled in transitively by hadoop-annotations on Java 8).

Fix

In MojoImplementation, when building the resolution modules, branch on scope: for Artifact.SCOPE_SYSTEM, use the file Maven already set from <systemPath> instead of issuing a remote ArtifactRequest. If that file is genuinely absent (e.g. tools.jar on JDK 11+), the artifact is skipped with a warning rather than aborting the whole bloopInstall (the dependency was never resolvable anyway). The compile/runtime classpath is unaffected — it still comes from Maven's own getCompileClasspathElements(), which already includes the system jar for the module that declares it.

Notes

  • System scope is not transitive in Maven, so a system dep only surfaces on the module that declares it — never on downstream consumers. The fix and tests reflect this.
  • The pre-existing try/catch in resolveArtifact already prevented a hard crash by swallowing the failed remote fetch; this change removes the wasted remote round-trips and the misleading error logging, and uses the provided path as intended.

@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!

@tgodzik
tgodzik merged commit 2883eab into scalacenter:main Jun 16, 2026
4 checks passed
@jozanek
jozanek deleted the fix/issue-27-system-scope-dependencies branch June 16, 2026 11:54
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.

maven-bloop can't resolve the 2-depth dependency with "system scope"

2 participants