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

Fail the build if a suitable image isn't available #1143

Closed
tofflos opened this issue Oct 15, 2018 · 2 comments
Closed

Fail the build if a suitable image isn't available #1143

tofflos opened this issue Oct 15, 2018 · 2 comments
Assignees
Milestone

Comments

@tofflos
Copy link

tofflos commented Oct 15, 2018

Description of the issue:
I successfully built my sample project but it crashed upon launch. I figured out that Jib uses the Docker image gcr.io/distroless/java which is based on Java 8. My sample project is based on Java 11.

Expected behavior:
The Maven plugin could choose an image more suited for my project or fail the build with a helpful error message in case a suitable image isn't available.

Steps to reproduce:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.8.0</version>
    <configuration>
        <release>11</release>
    </configuration>
</plugin>

Environment:
Windows 10, Maven 3.5.0, OpenJDK 18.9 (build 11+28)

jib-maven-plugin Configuration:

<plugin>
    <groupId>com.google.cloud.tools</groupId>
    <artifactId>jib-maven-plugin</artifactId>
    <version>0.9.11</version>
    <configuration>
        <to>
            <image>sample-project</image>
        </to>
    </configuration>
</plugin>

Log output:
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/example/business/items/ItemResource has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

@coollog
Copy link
Contributor

coollog commented Oct 15, 2018

Hi @tofflos , thanks for reporting this issue! We are actively working on providing a Java 11 version of distroless (GoogleContainerTools/distroless#236), which will be the default image used for Java 11 projects. In the meantime, I think we should add a warning if a project is using Java >8 @GoogleContainerTools/java-tools

@coollog coollog added this to the 0.10.1 milestone Oct 15, 2018
@chanseokoh
Copy link
Member

I think we should error out if a project is using Java >8, maybe with a suggestion to use another publicly available base image.

@tofflos for now, I think you can configure Jib to use one of openjdk:11, openjdk:11-slim, openjdk:11-jre, or openjdk:11-jre-slim, for example. (BTW, I don't find alpine versions for 11.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants