Skip to content

Java Maven Example Docker Doesn't Work #588

@t-rad679

Description

@t-rad679

I discovered there was an issue trying to copy the java maven example BUILD and modifying it for my own application. In that case I got the error "Unable to access jarfile /app.jar" (/app.jar is the name of the application jar I built and is provided in a tar target).

When I checked out this repo and just ran bazel run :container_test, I get the following output:

DEBUG: /private/var/tmp/_bazel_tr185153/021051042ffa78b6f08c0f6840c854f5/external/rules_jvm_external~/private/extensions/maven.bzl:141:14: The maven repository 'maven' is used in two different bazel modules, originally in '' and now in 'protobuf'
DEBUG: /private/var/tmp/_bazel_tr185153/021051042ffa78b6f08c0f6840c854f5/external/rules_jvm_external~/private/extensions/maven.bzl:141:14: The maven repository 'maven' is used in two different bazel modules, originally in '' and now in 'protobuf'
DEBUG: /private/var/tmp/_bazel_tr185153/021051042ffa78b6f08c0f6840c854f5/external/rules_jvm_external~/private/extensions/maven.bzl:141:14: The maven repository 'maven' is used in two different bazel modules, originally in '' and now in 'protobuf'
DEBUG: /private/var/tmp/_bazel_tr185153/021051042ffa78b6f08c0f6840c854f5/external/rules_jvm_external~/private/extensions/maven.bzl:141:14: The maven repository 'maven' is used in two different bazel modules, originally in '' and now in 'protobuf'
DEBUG: /private/var/tmp/_bazel_tr185153/021051042ffa78b6f08c0f6840c854f5/external/rules_jvm_external~/coursier.bzl:593:18: Found duplicate artifact versions
    com.google.guava:guava has multiple versions 28.0-jre, 31.1-jre
    junit:junit has multiple versions 4.12, 4.13.2
Please remove duplicate artifacts from the artifact list so you do not get unexpected artifact versions
INFO: Analyzed target //:container_test (117 packages loaded, 1791 targets configured).
ERROR: /private/var/tmp/_bazel_tr185153/021051042ffa78b6f08c0f6840c854f5/external/rules_java~/toolchains/BUILD:285:14: JavaToolchainCompileBootClasspath external/rules_java~/toolchains/platformclasspath.jar failed: (Exit 1): java failed: error executing JavaToolchainCompileBootClasspath command (from target @@rules_java~//toolchains:platformclasspath) external/rules_java~~toolchains~remotejdk11_macos_aarch64/bin/java -XX:+IgnoreUnrecognizedVMOptions -XX:-UsePerfData '--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED' ... (remaining 7 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
Exception in thread "main" java.io.IOException: external/rules_java~~toolchains~local_jdk/lib/jrt-fs.jar not exist
	at java.base/jdk.internal.jrtfs.JrtFileSystemProvider.newFileSystem(JrtFileSystemProvider.java:118)
	at java.base/jdk.internal.jrtfs.JrtFileSystemProvider.newFileSystem(JrtFileSystemProvider.java:106)
	at java.base/java.nio.file.FileSystems.newFileSystem(FileSystems.java:337)
	at java.base/java.nio.file.FileSystems.newFileSystem(FileSystems.java:286)
	at DumpPlatformClassPath.dumpJDK9AndNewerBootClassPath(DumpPlatformClassPath.java:104)
	at DumpPlatformClassPath.main(DumpPlatformClassPath.java:66)
Target //:container_test failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 40.632s, Critical Path: 2.29s
INFO: 26 processes: 21 internal, 2 darwin-sandbox, 3 local.
ERROR: Build did NOT complete successfully
//:container_test                                               FAILED TO BUILD

Executed 0 out of 1 test: 1 fails to build.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions