Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

util/resolve/maven: do not ignore direct test and optional dependencies #195

Merged
merged 4 commits into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions util/resolve/maven/resolve.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,7 @@ func (r *resolver) resolve(ctx context.Context, vk resolve.VersionKey, requireme

var opt importsOpt
if first {
// We skip test and optional dependencies, as for a consumer, none
// would be included (the optional would be indirect).
// https://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html#how-do-optional-dependencies-work
opt = providedImports
opt = testImports | optImports | providedImports
}
imps, err := r.imports(ctx, cur.VersionKey, opt)
if err == resolve.ErrNotFound && !first {
Expand Down
4 changes: 4 additions & 0 deletions util/resolve/maven/testdata/resolve_test.want
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,14 @@ group:alice 1.0

-- Graph optional01
group:alice 1.0
└─ selector|group:bob@ 1.0
└─ selector|group:chuck@ 1.0
-- END

-- Graph ignoreTest01
group:alice 1.0
└─ selector|group:bob@ 1.0
└─ selector|group:chuck@ 1.0
-- END

-- Graph management
Expand Down
Loading