-
-
Notifications
You must be signed in to change notification settings - Fork 645
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
allow excluding transitive jars from jvm_artifact
targets
#13683
Comments
Can you use !! ignores in the dependencies field instead? The dependencies toolbox at https://www.pantsbuild.org/docs/targets |
I'm not sure that would cover this case. Given |
jvm_artifact
targetsjvm_artifact
targets
Taking this on -- it looks like |
I see at least two similar but slightly different use cases for exclusions:
(1) points at exclusions being a per-resolve item (like Scala version), while (2) points at it being a per- |
I had the use case in (2) in the past in Pants v1 to resolve conflicting versions of |
@tdyas I'm going to aim for solving (2) initially, since it's the easier option, which should be easy enough, given that we fetch artifacts on an individual basis. We may need to think a bit harder about how to model (1). I haven't tested coursier's behaviour if you specify a specific version to fetch, but it'd be interesting to see what happens if a higher version shows up as a transitive dependency. Let me go try that one out. |
We fetch individually but we resolve lockfiles collectively by passing in all of the coordinates:
Thinking "aloud", this brings up some points about when exclusion can be applied (with some regard to whether the user writes it in a
|
Per below, it looks like Coursier's default way to handle a complex resolve is to use the newest version of the artifact. This means we'll need to force our version of the artifact when we do the resolve (re-specifying the versions from our We will still need to specify excludes at fetch time to ensure that the transitive dependency isn't fetched (this is actually even more important than before, since we won't have a SHA digest for the excluded dependency.
|
Might be relevant: I had to disable "strict" resolution of versions due to a bug described in #13496. Not directly on-point with exclusions but we may want to revisit strict dependency resolution again. |
So for starters, which version of
|
The flag used for a local exclude in v1 was: pants/src/python/pants/backend/jvm/tasks/coursier_resolve.py Lines 509 to 516 in 674df55
|
Adds `excludes`, which accepts unversioned coordinates to exclude as transitive dependencies of that artifact. This is passed to Coursier's `--local-excludes-file` at resolve time, so it's excluded in the lockfile. Consequently, we also add excludes to the metadata string for lockfiles. Closes #13683.
Pants v1 supported excluding certain jars from the transitive dependency graph of a
jar_libary
target. Thejvm_artifact
target type should also support exclusions. If done in a similar manner to v1, it would be via anexclusions
field onjvm_artifact
.It also supported an
intransitive=True
flag, which excluded all transitive dependencies.The text was updated successfully, but these errors were encountered: