Skip to content

Mismatching JDK versions leads to mvn compile and docker build to fail #227

Closed

Description

@mortendaehli

The current version in the CI is running on JDK11, while the docker image and tomcat still depends on JDK8.

I suggest that the Dockerfile points to openjdk-11 and that the pom.xml changes from <java.target>8</java.target> to <java.target>11</java.target>. This seems to resolve the issue.

Activity

  1. davewichers commented on May 1, 2024

    @davewichers
    Contributor

    @mortendaehli - I just pushed an update to the Benchmark Docker image to upgrade Java to Java 11. I didn't make the pom change but I don't think that matters. Please confirm this fixes the Docker image.

  2. Qwarctick commented on May 2, 2024

    @Qwarctick

    You push only the arm64 version of the image. So I cannot test on my machine the image amd64 from Docker Hub.

    The recommanded modification from @mortendaehli seems to work !

  3. davewichers commented on May 2, 2024

    @davewichers
    Contributor

    @Qwarctick / @thc202 - I figured it out. I have now pushed an update which is for AMD64, and Java 11. Can you test to verify it works as expected? And if you can help me figure out how to generate a Multiplatform version for both AMD64 and ARM64, I'll push that. Right now I can generate 1 for each, but not 1 that supports both.

  4. Qwarctick commented on May 3, 2024

    @Qwarctick

    Yes Thanks ! The amd64 version of docker hub works. As far as I know, it is not possible to generate a cross-platform image. You have to push both for each modification. I recommend adding this step to your CI to avoid doing it every time. This question should be discussed in the issue #223

    For the current issue, the problem is still the same. We cannot build locally the image. Migrating from java 8 to 11 seems to solve the problem. I also tried with java 19 and it works. But we should use java 11 to use the same version than the CI.

  5. davewichers commented on May 3, 2024

    @davewichers
    Contributor

    It appears this is now fixed, so I'm closing this issue, but I still need to also push an ARM64 version out too.

  6. Qwarctick commented on May 7, 2024

    @Qwarctick

    I'm sad that the issue is closed because the main problem hasn't been solved. The problem is that you can't build the docker image using the script buildDockerImage.sh. The build failed with the message

    4.776 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.4.1:enforce (enforce-jdk-version) on project benchmarkutils-parent:
    4.776 [ERROR] Rule 0: org.apache.maven.enforcer.rules.version.RequireJavaVersion failed with message:
    4.776 [ERROR] BenchmarkUtils is currently written to support Java 11.
    4.776 [ERROR] -> [Help 1]
    4.776 [ERROR]
    4.776 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    4.776 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    4.776 [ERROR]
    4.776 [ERROR] For more information about the errors and possible solutions, please read the following articles:
    4.776 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
    

    The solution to fix the problem is to change the version of java in the image from 8 to 11. I can create the PR if it's ok for you.

  7. davewichers commented on May 7, 2024

    @davewichers
    Contributor

    Hey @Qwarctick, sorry about that. I forgot to push the Dockerfile changes to match this fix. I just did that with commit d6a3e01. I also plan to push 2 more Docker creation/run scripts, one for ARM64 and one for AMD64, that way if someone wants to build an image that's for a different platform, like I have to for AMD64 (since I use an M1 Mac), they can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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