bazel: On Windows: NullPointerException on fetching jars from repository defined with maven_server

Bazel manages to fetch all external jar dependencies defined with maven_jar from the standard repositories. However every single jar that uses a repository defined with maven_server results in a NullPointerException on transfer.

ERROR: C:/Projects/everything/third_party/flagz/BUILD:5:1: no such package '@flagz_core_artifact//jar': Failed to fetch Maven dependency: Could not transfer artifact org.flagz:flagz:jar:2.2.0 from/to flagz_core_artifact (https://<obfuscated-host>/content/repositories/releases/): NullPointerException and referenced by '//third_party/flagz:flagz'.
ERROR: C:/Projects/everything/third_party/flagz/BUILD:15:1: no such package '@flagz_core_artifact//jar': Failed to fetch Maven dependency: Could not transfer artifact org.flagz:flagz:jar:2.2.0 from/to flagz_core_artifact (https://<obfuscated-host>/content/repositories/releases/): NullPointerException and referenced by '//third_party/flagz:flagz_scala'.
ERROR: C:/Projects/everything/third_party/flagz/BUILD:15:1: no such package '@flagz_scala_artifact//jar': Failed to fetch Maven dependency: Could not transfer artifact org.flagz:flagz-scala_2.11:jar:2.2.0 from/to flagz_scala_artifact (https://<obfuscated-host>/content/repositories/releases/): NullPointerException and referenced by '//third_party/flagz:flagz_scala'.
[...]

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 1
  • Comments: 27 (24 by maintainers)

Most upvoted comments

To fix this error I had to make sure maven_server name and server id matched:

maven_server(
  name = "the_cave",
  url = "https://myartefacts.xyz/artifactory/libs",
)

~/.m2/settings.xml

     <servers>
         <server>
             <id>the_cave</id>
             <username>alibaba</username>
             <password>openseasame</password>
         </server>
     </servers>