Skip to content

Commit

Permalink
Fix edge case where dep depends on a pom file (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
plaird authored Nov 7, 2024
1 parent 62d9a1c commit 01e8116
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
20 changes: 14 additions & 6 deletions crawl/bazel.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,12 +310,20 @@ def _get_direct_deps(direct_dep_coords_wo_vers, coord_wo_vers_to_dep, maven_inst
break

if direct_dep is None:
msg = "Failed to find top level dependency instance for [{0}] with direct dep coord [{1}]".format(
maven_install_filename, direct_dep_coord_wo_vers)
logger.warning(msg)
assert not fail_on_missing, msg
return []
direct_deps.append(direct_dep)
if direct_dep_coord_wo_vers.endswith(":pom"):
# this is an edge case where a dependency is a pom
# ex: org.kie.modules:org-apache-commons-lang3:pom
msg = "Direct dependency on a pom [{0}] in namespace [{1}] is ignored. Please depend on actual jar files instead.".format(
direct_dep_coord_wo_vers, maven_install_filename)
logger.warning(msg)
else:
msg = "Failed to find top level dependency instance for [{0}] with direct dep coord [{1}]".format(
maven_install_filename, direct_dep_coord_wo_vers)
logger.warning(msg)
assert not fail_on_missing, msg
return []
else:
direct_deps.append(direct_dep)
return direct_deps


Expand Down
3 changes: 2 additions & 1 deletion tests/bazeltest.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ def _get_dep_and_transitives(self, result, group_id, artifact_id, rule_name):
"google.guava:guava"
],
"org.apache.kafka:kafka-clients:jar:test": [
"ch.qos.logback:logback-core"
"ch.qos.logback:logback-core",
"org.kie.modules:org-apache-commons-lang3:pom"
],
"org.springframework.kafka:spring-kafka-test": [
"org.apache.kafka:kafka-clients:jar:test"
Expand Down

0 comments on commit 01e8116

Please sign in to comment.