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

Breaks Quarkus maven package and native image generation in docker #175

Closed
1 task done
vincejv opened this issue Oct 15, 2022 · 3 comments
Closed
1 task done

Breaks Quarkus maven package and native image generation in docker #175

vincejv opened this issue Oct 15, 2022 · 3 comments

Comments

@vincejv
Copy link

vincejv commented Oct 15, 2022

Issue

version: 1.9.0

usage context:

  • quarkus 2.13.1.Final (mvn package & building a native image through docker)

Problem description:

#18 18.04 [INFO] Downloaded from central: https://repo.maven.apache.org/maven2/io/quarkus/platform/quarkus-bom/2.13.1.Final/quarkus-bom-2.13.1.Final.pom (357 kB at 8.7 MB/s)
Error: 06 [ERROR] [ERROR] Some problems were encountered while processing the POMs:
#18 18.06 [ERROR] Unresolveable build extension: Plugin io.quarkus.platform:quarkus-maven-plugin:2.13.1.Final or one of its dependencies could not be resolved: Failed to collect dependencies at io.quarkus.platform:quarkus-maven-plugin:jar:2.13.1.Final -> io.quarkus:quarkus-bootstrap-maven-resolver:jar:2.13.1.Final -> org.apache.maven:maven-embedder:jar:3.8.6 -> org.apache.maven:maven-settings-builder:jar:3.8.6 -> org.codehaus.plexus:plexus-interpolation:jar:1.26 @ 
#18 18.06  @ 
#18 18.06 [ERROR] The build could not read 1 project -> [Help 1]
#18 18.06 [ERROR]   
#18 18.06 [ERROR]   The project org.acme:code-with-quarkus:0.0.0-2-6f66ea64 (/code/pom.xml) has 1 error
#18 18.07 [ERROR]     Unresolveable build extension: Plugin io.quarkus.platform:quarkus-maven-plugin:2.13.1.Final or one of its dependencies could not be resolved: Failed to collect dependencies at io.quarkus.platform:quarkus-maven-plugin:jar:2.13.1.Final -> io.quarkus:quarkus-bootstrap-maven-resolver:jar:2.13.1.Final -> org.apache.maven:maven-embedder:jar:3.8.6 -> org.apache.maven:maven-settings-builder:jar:3.8.6 -> org.codehaus.plexus:plexus-interpolation:jar:1.26: Failed to read artifact descriptor for org.codehaus.plexus:plexus-interpolation:jar:1.26: Could not find artifact org.codehaus.plexus:plexus:pom:0.0.0-2-6f66ea64 in central (https://repo.maven.apache.org/maven2) -> [Help 2]
#18 18.07 [ERROR] 
#18 18.07 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
#18 18.07 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
#18 18.07 [ERROR] 
#18 18.07 [ERROR] For more information about the errors and possible solutions, please read the following articles:
#18 18.07 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
#18 18.07 [ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/PluginManagerException
#18 ERROR: process "/bin/sh -c ./mvnw -B package -Pnative" did not complete successfully: exit code: 1

The following Dockerfile was used

## Stage 1 : build with maven builder image with native capabilities
FROM quay.io/quarkus/ubi-quarkus-native-image:22.2-java17 AS build
# Copy .git folder for jgitver to calculate the version
COPY --chown=quarkus:quarkus .git /code/.git
# Copy maven executables
COPY --chown=quarkus:quarkus mvnw /code/mvnw
COPY --chown=quarkus:quarkus .mvn /code/.mvn
COPY --chown=quarkus:quarkus pom.xml /code/
USER quarkus
WORKDIR /code
RUN chmod +x ./mvnw
# RUN ./mvnw -s ./.mvn/wrapper/settings.xml -B org.apache.maven.plugins:maven-dependency-plugin:3.1.2:go-offline
RUN pwd
RUN ./mvnw --version
RUN ls -alh
RUN ./mvnw -B package -Pnative

## Stage 2 : create the docker final image
FROM quay.io/quarkus/quarkus-micro-image:1.0
WORKDIR /work/
COPY --from=build /code/target/*-runner /work/application

# set up permissions for user `1001`
RUN chmod 775 /work /work/application \
  && chown -R 1001 /work \
  && chmod -R "g+rwX" /work \
  && chown -R 1001:root /work

EXPOSE 8080
USER 1001

CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]

I've gone through issue #90 & #91 since the errors are similar, but don't think that this is the issue, as on my jgitver config I've excluded m2 (even though unnecessary) as when I ran ls -alh and mvn --version, the MLR is in ~/.m2

See the following logs for ls -alh and mvnw --version

#16 [build  9/11] RUN ./mvnw --version
#0 0.081   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
#16 0.090                                  Dload  Upload   Total   Spent    Left  Speed
#16 0.097 
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 59925  100 59925    0     0   562k      0 --:--:-- --:--:-- --:--:--  562k
#16 1.107 Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
#16 1.107 Maven home: /home/quarkus/.m2/wrapper/dists/apache-maven-3.8.6-bin/67568434/apache-maven-3.8.6
#16 1.107 Java version: 17.0.4, vendor: GraalVM Community, runtime: /opt/graalvm
#16 1.107 Default locale: en_US, platform encoding: UTF-8
#16 1.107 OS name: "linux", version: "5.15.0-1020-azure", arch: "amd64", family: "unix"
#16 DONE 1.2s

#17 [build 10/11] RUN ls -alh
#0 0.075 total 44K
#0 0.075 drwxr-xr-x 1 quarkus quarkus 4.0K Oct 15 20:41 .
#0 0.075 drwxr-xr-x 1 root    root    4.0K Oct 15 20:41 ..
#0 0.075 drwxr-xr-x 8 quarkus quarkus 4.0K Oct 15 20:41 .git
#0 0.075 drwxr-xr-x 1 quarkus quarkus 4.0K Oct 15 20:41 .mvn
#0 0.075 -rwxr-xr-x 1 quarkus quarkus  11K Oct 15 20:41 mvnw
#0 0.075 -rw-r--r-- 1 quarkus quarkus 4.2K Oct 15 20:41 pom.xml
#17 DONE 0.1s

jgitver.config.xml

<configuration xmlns="http://jgitver.github.io/maven/configuration/1.1.0"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://jgitver.github.io/maven/configuration/1.1.0 https://jgitver.github.io/maven/configuration/jgitver-configuration-v1_1_0.xsd">
    <useGitCommitId>true</useGitCommitId>
    <autoIncrementPatch>true</autoIncrementPatch>
    <useCommitDistance>true</useCommitDistance>
    <gitCommitIdLength>8</gitCommitIdLength>
    <strategy>CONFIGURABLE</strategy>
    <nonQualifierBranches>main</nonQualifierBranches>
    <exclusions>    <!-- Optional list of directory path -->
        <exclusion>.m2</exclusion>    <!-- relative path from project root directory -->
        <exclusion>.mvn</exclusion>    <!-- relative path from project root directory -->
    </exclusions>
</configuration>

Let me know if you need further information

@vincejv vincejv changed the title Breaks Quarkus native image generation through docker Breaks Quarkus, maven package and native image generation through docker Oct 15, 2022
@vincejv vincejv changed the title Breaks Quarkus, maven package and native image generation through docker Breaks Quarkus maven package and native image generation through docker Oct 15, 2022
@vincejv vincejv changed the title Breaks Quarkus maven package and native image generation through docker Breaks Quarkus maven package and native image generation in docker Oct 15, 2022
@vincejv
Copy link
Author

vincejv commented Oct 15, 2022

Let me know if you need additional information @McFoggy

@vincejv
Copy link
Author

vincejv commented Oct 15, 2022

Seems like something with Quarkus maven plugin doesn't work correctly with jgitver

    <plugin>
          <groupId>${quarkus.platform.group-id}</groupId>
          <artifactId>quarkus-maven-plugin</artifactId>
          <version>${quarkus.platform.version}</version>
          <extensions>true</extensions>
          <executions>
            <execution>
              <goals>
                <goal>build</goal>
                <goal>generate-code</goal>
                <goal>generate-code-tests</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

@vincejv
Copy link
Author

vincejv commented Oct 15, 2022

Closing the issue as I have found a work around, instead of using the 2 Stage Dockerfile to build the native image, I used the default 1 Stage Dockerfile like so

FROM quay.io/quarkus/quarkus-micro-image:1.0
WORKDIR /work/
RUN chown 1001 /work \
    && chmod "g+rwX" /work \
    && chown 1001:root /work
COPY --chown=1001:root target/*-runner /work/application

EXPOSE 8080
USER 1001

CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]

and build the native image in the previous step, using the built-in quarkus docker orchestrator

- name: Generate native image
  run: mvn -B package -Pnative -Dquarkus.native.container-build=true

I'm not 100% sure what's causing the issue, but it's somewhere on the first stage of the Dockerfile... but since I found a workaround, might as well close this.

@vincejv vincejv closed this as completed Oct 15, 2022
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

1 participant