The documentation for `jvm_artifact` suggests it's...
# general
r
The documentation for
jvm_artifact
suggests it's possible to specify a
jvm_exclude
that contains group and artifact or only group.
`jvm_exclude`: Exclude the given
artifact
and
group
, or all artifacts from the given
group
.
But when I attempt to only specify a group
Copy code
jvm_exclude(group="org.slf4j"),
I get an error like this.
Copy code
Failed to parse org.slf4j
Failed to parse org.slf4j
This seems to be coming directly from coursier, and as far as I can tell group-only excludes aren't supported. Am I missing something? Is anyone successfully using a group-only exclude like this?
So this'll require some debugging to figure out the difference between that situation and yours
r
I think that test shows that Pants doesn't have a problem creating an artifact with group-only exclusions. The issue occurs when I run
pants generate-lockfiles
. I can create a simple example if that would help.
h
That would super help!
r
Sorry for the delay, here is an example: https://github.com/NGustafson/pants-examples/blob/main/3rdparty/jvm/BUILD This repo has a single jvm_artifact with nothing else configured. Attempting to run
pants generate-lockfiles
will cause this error:
Copy code
pants generate-lockfiles                                                                                                                ✔  20:31:31 
20:35:29.17 [ERROR] 1 Exception encountered:

Engine traceback:
  in `generate-lockfiles` goal

ProcessExecutionFailure: Process 'Running `coursier fetch` against 1 requirement: org.slf4j:slf4j-log4j12:2.0.12' failed with exit code 1.
stdout:

stderr:
+ coursier_exe=__coursier/./cs-aarch64-apple-darwin
+ shift
+ json_output_file=coursier_report.json
+ shift
++ pwd
+ working_dir=/private/var/folders/cm/gmrdwxcn7tv_cct4dzg38w91kjyl1q/T/pants-sandbox-aM4FVB
+ __coursier/./cs-aarch64-apple-darwin fetch -r=<https://maven-central.storage-download.googleapis.com/maven2> -r=<https://repo1.maven.org/maven2> --no-default --json-output-file=coursier_report.json org.slf4j:slf4j-log4j12:2.0.12 --local-exclude-file PANTS_RESOLVE_EXCLUDES
Failed to parse org.slf4j
Failed to parse org.slf4j
My understanding is that the 3 variations of
jvm_exclude
in the
jvm_target
linked above all represent the same thing within Pants, and that this seems to be legal syntax, but all of them result in the same error.
I would like to report this as a bug and consider how to deal with it, if someone could confirm that I'm not just making some dumb mistake.
h
Yep, that does seem like a bug!
Best to start by filing an issue at https://github.com/pantsbuild/pants/issues
👍 1
Link to it here, and we can discuss there how to investigate and fix
r
I have created the issue https://github.com/pantsbuild/pants/issues/20794 After trying out Coursier for a bit it seems like this sort of syntax works
--exclude 'org.slf4j:*'
, but this syntax in Pants causes a different error
jvm_exclude(group="org.slf4j", artifact="*")
. Maybe I could try and get that working?
🙏 1
h
Thanks for investigating! That makes sense to me to implement, as it directly mirrors what Coursier accepts. So I guess it would be a pretty straightforward change to get Pants to accept
artifact="*"
if you want to take a stab at it
👍 1