cool-easter-32542
05/28/2024, 9:15 AMClasspathSourceAmbiguity exception when building the classpath for sources that depend on the Java generated code.
ClasspathSourceAmbiguity: More than one JVM classpath provider (CompileJavaSourceRequest, CompileScalaSourceRequest, CoursierFetchRequest, DeployJarClasspathEntryRequest, JvmResourcesRequest, NoopClasspathEntryRequest, ScalaArtifactClasspathEntryRequest) was compatible with the inputs:
* src/openapi:spec (openapi_document)
To reproduce this requires (at least) the following backends to be enabled:
backend_packages = [
"pants.backend.experimental.java",
"pants.backend.experimental.openapi",
"pants.backend.experimental.openapi.codegen.java",
]
And then having the following targets:
src/openapi/BUILD
openapi_document(name="spec", source="openapi_spec.yaml")
`src/java/foo/BUILD`:
java_sources(dependencies=["//src/openapi:spec"])
The exception is thrown when running pants check ::.
I believe this was added after #20695.
Pants version
2.22.x (main)
OS
both
Additional info
The error message thrown should also be improved as it is showing a list of all the supported ClasspathEntryRequest implementations available in Pants, while the ambiguity is created by the fact that CompileJavaSourceRequest and JvmResourcesRequest are the ones capable of providing a valid classpath entry for the openapi_document target.
pantsbuild/pantscool-easter-32542
05/29/2024, 6:54 PM