Open kigero opened 4 years ago
Can you try to use Coursier CLI directly resolve the artifact, and see if it downloads the classified jar successfully? rules_jvm_external simply parses the dependency tree output of Coursier CLI, so it doesn't know if there's should have been an error there.
We can definitely make RJE throw or fail, if we can come up with a general heuristic from your repro (existence of jar.err
?).
I tried the following with coursier 2.0.0-RC6-24 running on Windows:
> coursier.bat fetch -r https://artifacts/archiva/repository/snapshots/ --no-default --cache . com.company:client:3.0.0-SNAPSHOT,classifier=badclassifier
Error fetching artifacts:
https://artifacts/archiva/repository/snapshots/com/company/client/3.0.0-SNAPSHOT/client-3.0.0-SNAPSHOT-badclassifier.jar: not found: https://artifacts/archiva/repository/snapshots/com/company/client/3.0.0-SNAPSHOT/client-3.0.0-SNAPSHOT-badclassifier.jar
> echo %ERRORLEVEL%
1
>find|grep client
./https/artifacts/archiva/repository/snapshots/com/company/client
./https/artifacts/archiva/repository/snapshots/com/company/client/3.0.0-SNAPSHOT
./https/artifacts/archiva/repository/snapshots/com/company/client/3.0.0-SNAPSHOT/.client-3.0.0-SNAPSHOT-badclassifier.jar.error
./https/artifacts/archiva/repository/snapshots/com/company/client/3.0.0-SNAPSHOT/.client-3.0.0-SNAPSHOT-badclassifier.jar.sha1.error
./https/artifacts/archiva/repository/snapshots/com/company/client/3.0.0-SNAPSHOT/.client-3.0.0-SNAPSHOT.pom.checked
./https/artifacts/archiva/repository/snapshots/com/company/client/3.0.0-SNAPSHOT/.client-3.0.0-SNAPSHOT.pom.sha1.checked
./https/artifacts/archiva/repository/snapshots/com/company/client/3.0.0-SNAPSHOT/client-3.0.0-SNAPSHOT.pom
./https/artifacts/archiva/repository/snapshots/com/company/client/3.0.0-SNAPSHOT/client-3.0.0-SNAPSHOT.pom.sha1
Using a valid classifier instead of "badclassifier" worked as expected. It does looks like there is an error from coursier though along with the .err files.
I recently used a maven_install call that looked like this:
Looks good, but my compile didn't seem to work, complaining about missing classes from a transitive dependency of the com.company:client artifact. So I tried adding that artifact directly, adding this to the
artifacts
property:This is the correct coordinate for this artifact, but I was still having the same issues. So after some troubleshooting, I found three things:
(notice the missing "jars" property)
external/parser_maven/v1/.../2.1.2-SNAPSHOT
directory for the artifact, I had this set of files:So what it looked like is the pom was able to be retrieved but the classified jar was not, since it didn't exist at the time. Given that this was the case should an error have been thrown during the retrieval stage, instead of at the compile stage when the classes were missing? I wouldn't have expected the "@parser_maven//:com_company_utils_util" label to resolve properly if the requested artifact wasn't found.