Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coursier does not use embedded JDK #450

Closed
MikhailTymchukFT opened this issue Aug 25, 2020 · 1 comment
Closed

Coursier does not use embedded JDK #450

MikhailTymchukFT opened this issue Aug 25, 2020 · 1 comment

Comments

@MikhailTymchukFT
Copy link

Description of the problem / feature request:

When there is no local JDK installed, running $ bazel run @maven//:pin fails with the following message:

INFO: Repository maven instantiated at:
  no stack (--record_rule_instantiation_callstack not enabled)
Repository rule coursier_fetch defined at:
  /private/var/tmp/_bazel_mikhailtymchuk/b9e5d63d3710c48dc7e8e425579b45fb/external/rules_jvm_external/coursier.bzl:798:33: in <toplevel>
INFO: Repository 'maven' used the following cache hits instead of downloading the corresponding file.
 * Hash '6598d9277705ad8369a4f9c64217fbc31c19234f2cbcca9b1e5c4300a3abb317' for https://github.com/coursier/coursier/releases/download/v2.0.0-RC5-3/coursier.jar
If the definition of 'maven' was updated, verify that the hashes were also updated.
ERROR: An error occurred during the fetch of repository 'maven':
   Unable to run coursier: No Java runtime present, requesting install.
ERROR: Unable to run coursier: No Java runtime present, requesting install.
INFO: Elapsed time: 0.347s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
FAILED: Build did NOT complete successfully (0 packages loaded)

Feature requests: what underlying problem are you trying to solve with this feature?

I'm trying to create maven_install.json file on a host without JDK.
I expect bazel uses embedded JDK (because it cannot use JDK provided as --host_javabase - it's too late, coursier already needs JDK at this moment).

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Complete example can be found here: https://github.com/MikhailTymchukFT/bazel-coursier-java-home-bug

WORKSPACE:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

RULES_JVM_EXTERNAL_TAG = "3.2"
RULES_JVM_EXTERNAL_SHA = "82262ff4223c5fda6fb7ff8bd63db8131b51b413d26eb49e3131037e79e324af"

http_archive(
    name = "rules_jvm_external",
    sha256 = RULES_JVM_EXTERNAL_SHA,
    strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG,
    url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % RULES_JVM_EXTERNAL_TAG,
)

load("@rules_jvm_external//:defs.bzl", "maven_install")

maven_install(
    artifacts = [
        "junit:junit:4.12"
    ],
    fetch_sources = True,
    repositories = [
        "http://uk.maven.org/maven2",
        "https://jcenter.bintray.com/",
    ],
)

http_archive(
    name = "openjdk8u202_darwin_archive",
    build_file_content = """
package(default_visibility = ["//visibility:public"])

java_runtime(
    name = 'runtime',
    srcs =  glob(['**']),
    java='//:Contents/Home/bin/java',
    java_home='abc'
)
""",
    sha256 = "059f7c18faa6722aa636bbd79bcdff3aee6a6da5b34940b072ea6e3af85bbe1d",
    strip_prefix = "jdk8u202-b08",
    urls = ["https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u202-b08/OpenJDK8U-jdk_x64_mac_hotspot_8u202b08.tar.gz"],
)

What operating system are you running Bazel on?

MacOS 10.15.6

What's the output of bazel info release?

release 3.4.1

Have you found anything relevant by searching the web?

Found a similar issue: bazelbuild/bazel#6993
However, there is no coursier-related problems there.

@jin
Copy link
Collaborator

jin commented Aug 25, 2020

Thanks for the report. Please file rules_jvm_external issues on https://github.com/bazelbuild/rules_jvm_external.

Closing this as a duplicate of #445

@jin jin closed this as completed Aug 25, 2020
@jin jin transferred this issue from bazelbuild/bazel Aug 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants