Skip to content

Fix provided deps resolution for maven#8306

Open
BoykoAlex wants to merge 6 commits into
openrewrite:mainfrom
BoykoAlex:mvn-provided-scope-deps
Open

Fix provided deps resolution for maven#8306
BoykoAlex wants to merge 6 commits into
openrewrite:mainfrom
BoykoAlex:mvn-provided-scope-deps

Conversation

@BoykoAlex

@BoykoAlex BoykoAlex commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Currently the direct runtime dependency is placed o the provided scope list of resolved dependencies which is not right. The direct (root) dependencies should not follow transitive dependency scope matrix when placed into scope buckets.

@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Jul 22, 2026
@BoykoAlex
BoykoAlex marked this pull request as draft July 22, 2026 00:49

@timtebeek timtebeek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks reasonable to me already; what made you mark this as draft still?

@BoykoAlex

BoykoAlex commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

@timtebeek AI helped creating this... It seems convincing at first but I learned my lesson using it with Gradle and started adding tests myself and realized that this is probably wrong. It is somewhat confusing that there are a number of scopes but only 3 types of classpaths: compile, rutnime, test. For scopes matching the classpath everything is obvious but for scope such as provided none of the other scopes can affect it seems yet it leaks into Compile and Test classpaths... Does it mean we should add a provided dependency under the compile and test scopes. If yes then table below that Claude has created:

     *           Compile   Provided   Runtime   Test
     * Compile:    T         T          T         T
     * Provided:   F         T          F         F
     * Runtime:    F         F          T         T
     * Test:       F         F          F         T

Should be:

     *           Compile   Provided   Runtime   Test
     * Compile:    T         F          T         T
     * Provided:   T         T          F         T
     * Runtime:    F         F          T         T
     * Test:       F         F          F         T

I also don't like that it changed ddScope related bit from using transitivity table to using the table above...

I'm still working on this... I'm leaning toward reverting what it did for ddScope and I'd put only provided dependencies under provided scope and nothing else and still trying to figure out if it makes sense to put provided scope depenencies under compile and test scopes.

I should see how this is done in the rewrite maven plugin...

@BoykoAlex

Copy link
Copy Markdown
Contributor Author

@timtebeek I started looking at this because saw a direct runtime dependency in the provided scope of resolved dependencies in MavenResolutionResult

@BoykoAlex

Copy link
Copy Markdown
Contributor Author

The test failure is related to downloading metadata from maven central. The download request gets a 401 response. The test UpgradeDependencyVersionTest > badManagedVersion().
Otherwise seems alright.

@BoykoAlex
BoykoAlex marked this pull request as ready for review July 24, 2026 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants