Welcome to the Linux Foundation Forum!

Section 5 Revision control with GIT - mvn build failed

Is anyone can provide the zip file generated by the start.spring.io page and share the exact mvn:alpine version? I do not know java, so rather than wasting time trying to understand why the build failed I wish I could get the same source and version used in the video.

Answers

  • Hi @bauger,

    If you provide details about your environment (local, cloud, OS and version), the command you ran and the error you experienced, I may try to reproduce it.

    Regards,
    Luis.

  • bauger
    bauger Posts: 37

    Hi Luis,

    please see below. Thanks for your help.

    Beatrice

    • OS

    $ uname -srm

    Linux 4.19.0-18-amd64 x86_64

    • Docker version

    $ sudo docker version

    Client: Docker Engine - Community
    Version: 20.10.12
    API version: 1.41
    Go version: go1.16.12
    Git commit: e91ed57
    Built: Mon Dec 13 11:45:37 2021
    OS/Arch: linux/amd64
    Context: default
    Experimental: true

    Server: Docker Engine - Community
    Engine:
    Version: 20.10.12
    API version: 1.41 (minimum version 1.12)
    Go version: go1.16.12
    Git commit: 459d0df
    Built: Mon Dec 13 11:43:46 2021
    OS/Arch: linux/amd64
    Experimental: false
    containerd:
    Version: 1.4.12
    GitCommit: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
    runc:
    Version: 1.0.2
    GitCommit: v1.0.2-0-g52b36a2
    docker-init:
    Version: 0.19.0
    GitCommit: de40ad0

    $ sudo docker container run --rm -it -v m2:/root/.m2 -v /home/bea/Lecture/Learning/LinuxFoundation/DevOps_Bootcamp/LFS261/git/hellocd:/app maven:alpine mvn spring-boot:run -f app/pom.xml

    and outputs:

    [INFO] Scanning for projects...
    [INFO]
    [INFO] ------------------------< com.example:hellocd >-------------------------
    [INFO] Building hellocd 0.0.1-SNAPSHOT
    [INFO] --------------------------------[ jar ]---------------------------------
    [INFO]
    [INFO] >>> spring-boot-maven-plugin:2.6.3:run (default-cli) > test-compile @ hellocd >>>
    [INFO]
    [INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ hellocd ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] Using 'UTF-8' encoding to copy filtered properties files.
    [INFO] Copying 1 resource
    [INFO] Copying 0 resource
    [INFO]
    [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ hellocd ---
    [INFO] Changes detected - recompiling the module!
    [INFO] Compiling 1 source file to /app/target/classes
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 1.516 s
    [INFO] Finished at: 2022-02-09T17:50:35Z
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project hellocd: Fatal error compiling: invalid target release: 11 -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

  • Hi Beatrice,

    Sorry for taking long in providing feedback, but it's not so easy to do the tests.
    I was able to reproduce the issue on Ubuntu 20.04.4 LTS. What distro and version did you tried with?

    Regards,
    Luis.

  • bauger
    bauger Posts: 37

    Hi Luis,

    thanks for taking time trying to reproduce the issue on your end. I'm running docker on Debian 4.19.208-1 (2021-09-29) x86_64 GNU/Linux.

    I finally used another alpine version to be able to continue following the tutorial.

    Béatrice

  • Hi Béatrice,

    It's a pleasure! Can you tell me what Alpine version worked for you, please?

    Thanks,
    Luis.

  • bauger
    bauger Posts: 37

    Hi Luis,

    unfortunately this section is before the Jenkins introduction, so I do not have any script to check. And due to resources constraint I had to prune Docker images no longer used. I'm afraid I cannot trace back with alpine version I used for sure. But, in the following section where the Docker image is written in a Jenkinsfile I used the maven:3.6.1-jdk-8-alpine.

    Thanks

    Béatrice

  • luisviveropena
    luisviveropena Posts: 938

    Hi Béatrice,

    Yep, the deployments are sensitive to different versions. We keep investigating in our end.

    Regards,
    Luis.

  • gouravshah
    gouravshah Posts: 100

    Thanks for pitching in @luisviveropena . @bauger maven:3.8-openjdk-11-slim image tag works with the latest version of the code. I have updated the lab guide and should be published soon.

  • luisviveropena
    luisviveropena Posts: 938

    It's a pleasure, @gouravshah .

    I have updated the lab guide and should be published soon.

    Wonderful!

    Luis.

  • Hi,
    I'm also experiencing issues compiling the build. The solution is to use maven:3.8-openjdk-11 image?
    attached the file with more details.

    executed:
    $ docker container run --rm -it -v m2:/root/.m2 -v /home/admin/Documents/Bootcamp/DevOps_SRE/Git/hellocd:/app maven:alpine mvn spring-boot:run -f /app/pom.xml -X

    Image:

    REPOSITORY TAG IMAGE ID CREATED SIZE
    maven alpine 7445f83cd169 2 years ago 122MB

  • manuel.nhiuana
    manuel.nhiuana Posts: 6
    edited March 15

    I can confirm, it works with image maven:3.8-openjdk-11-slim , solution pointed by @gouravshah

    @manuel.nhiuana said:
    Hi,
    I'm also experiencing issues compiling the build. The solution is to use maven:3.8-openjdk-11 image?
    attached the file with more details.

    executed:
    $ docker container run --rm -it -v m2:/root/.m2 -v /home/admin/Documents/Bootcamp/DevOps_SRE/Git/hellocd:/app maven:alpine mvn spring-boot:run -f /app/pom.xml -X

    Image:

    REPOSITORY TAG IMAGE ID CREATED SIZE
    maven alpine 7445f83cd169 2 years ago 122MB

  • Hi @manuel.nhiuana , yes, maven:3.8-openjdk-11-slim is the version that Gourav tested and confirmed it's working :)

    I'm glad it worked for you too.

    Many regards,
    Luis.

Categories

Upcoming Training