Hi,
My BUILD file has a genrule() as follows:
genrule(
name = "gen_ism_encry_jar",
srcs = [":Combine_complieAndJar"],
outs = ["ism_encry.jar"],
cmd = "cp $(location :Combine_complieAndJar) $@; jar uf $@ " + baseDir + "Install_Moudle/ISM-Encry/src/log4j.properties",
)
When building bazel reports that jar command not found. However, jar is installed and it is in the PATH (executing 'which jar' will print '/usr/local/java/jdk1.8.0_77/bin/jar').
I used the bazel build command with '-s' option and got the failed command as follows:
(cd /root/.cache/bazel/_bazel_root/62a52d88f2594916d0a2e0364313b1a5/SPA && \
exec env - \
PATH=/usr/local/java/bin:/usr/local/java/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/java/jdk1.8.0_77/bin:/usr/local/java/jdk1.8.0_77/jre//bin:/usr/local/apache-ant/bin:/usr/local/java/jdk1.8.0_77/bin:/usr/local/java/jdk1.8.0_77/jre//bin:/usr/local/apache-ant/bin:/usr/local/java/jdk1.8.0_77/bin:/usr/local/java/jdk1.8.0_77/jre//bin:/usr/local/apache-ant/bin:/usr/local/java/jdk1.8.0_77/bin:/usr/local/java/jdk1.8.0_77/jre//bin:/usr/local/apache-ant/bin \
/bin/bash -c 'source external/bazel_tools/tools/genrule/genrule-setup.sh; cp bazel-out/local_linux-fastbuild/bin/libCombine_complieAndJar.jar bazel-out/local_linux-fastbuild/genfiles/ism_encry.jar;
jar uf bazel-out/local_linux-fastbuild/genfiles/ism_encry.jar systemAnalyzer/Install_Moudle/ISM-Encry/src/log4j.properties')
To my surprise, directly executing the above command in the shell returns 0.
In another machine, in which jar is installed in /usr/bin/jar from Oracle jdk 1.8, this failure is not reported.
Can anyone give some help?
Thank you very much!
Regards,
Leo