bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
23.1k stars 4.04k forks source link

maven_server settings_file does not support home directories as it's supposed to #8098

Closed codesuki closed 4 years ago

codesuki commented 5 years ago

Description of the problem / feature request:

maven_server( 
settings_file="~/.m2/settings.xml"
)

This looks for {WORKSPACE_PATH}/~/.m2/settings.xml Although the documentation explicitly says we can use the home directory here.


settings_file | String; optionalA path to a settings.xml file. Used for testing. If unspecified, this defaults to using$M2_HOME/conf/settings.xml for the global settings and $HOME/.m2/settings.xml for the user settings.

When trying $HOME instead of ~ it looks in workspace/$HOME/, notice $HOME is the string and is not replaced.

What operating system are you running Bazel on?

osx

What's the output of bazel info release?

0.24.0

Have you found anything relevant by searching the web?

Possibly related: https://github.com/bazelbuild/bazel/issues/6200

Any other information, logs, or outputs that you want to share?

: ERROR: /workspace/BUILD.bazel:14:1: no such package '@org_apache_avro_avro_protobuf//jar': Could not find settings file [/workspace/~/.m2/settings.xml]/[] and referenced by '//:xxx_jfrog_avro_protobuf'

I tracked it down to this piece of code:

https://github.com/bazelbuild/bazel/blob/e54491e10db727f757f7ac0d50ce1bc76102625b/src/main/java/com/google/devtools/build/lib/bazel/repository/MavenServerFunction.java#L105-L111

It prepends the workspace path, which might stop this from working:

https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/util/OptionsUtils.java#L154-L159

(if it ever gets that far)

dslomov commented 5 years ago

maven_server is being deprecated, @dkelmer is working on a replacement supporting authentication

meisterT commented 4 years ago

This is probably no longer relevant.