micronaut-projects / micronaut-maven-plugin

Maven plugin to execute Micronaut applications
https://micronaut-projects.github.io/micronaut-maven-plugin/latest/
Apache License 2.0
20 stars 18 forks source link

dockerBuildNative fails due to native-image args parsing errors on windows #1098

Open houcine7 opened 2 months ago

houcine7 commented 2 months ago
[INFO] Args file written to: gcp\target\native-image-17170149290747285130.args
[INFO]
[INFO] --- mn:4.5.2:docker-native (default-docker-native) @ gcp ---
[WARNING] The parent POM of this project is not set to io.micronaut.platform:micronaut-parent
[INFO] Exposing port: 8080
[INFO] Using BASE_IMAGE: ghcr.io/graalvm/native-image-community:17-ol9
[INFO] GraalVM native image build args: [--no-fallback, -o, C:\\Users\\Public\\dev\\gcp-kubernetes-demo-java-maven\\users\\gcp\\target\\gcp, -H:ConfigurationFileDirectories=/home/app/graalvm-reachability-metadata//netty-codec-http2//4.1.80.Final,/home/app/graalvm-reachability-metadata//caffeine//3.1.2,/home/app/graalvm-reachability-metadata//netty-common//4.1.80.Final,/home/app/graalvm-reachability-metadata//netty-transport//4.1.80.Final,/home/app/graalvm-reachability-metadata//kotlin-stdlib//1.7.10,/home/app/graalvm-reachability-metadata//commons-compress//1.23.0,/home/app/graalvm-reachability-metadata//netty-buffer//4.1.80.Final,/home/app/graalvm-reachability-metadata//netty-handler//4.1.80.Final,/home/app/graalvm-reachability-metadata//netty-codec-http//4.1.80.Final,/home/app/graalvm-reachability-metadata//jackson-databind//2.15.2,/home/app/graalvm-reachability-metadata//logback-classic//1.4.9, --no-fallback, --exclude-config, \\QC:\\Users\\Lahoucine, EL, ADDALI\\.m2\\repository\\io\\netty\\netty-codec-http2\\4.1.108.Final\\netty-codec-http2-4.1.108.Final.jar\\E, ^/META-INF/native-image/, --exclude-config, \\QC:\\Users\\Lahoucine, EL, ADDALI\\.m2\\repository\\io\\netty\\netty-handler\\4.1.108.Final\\netty-handler-4.1.108.Final.jar\\E, ^/META-INF/native-image/, --exclude-config, \\QC:\\Users\\Lahoucine, EL, ADDALI\\.m2\\repository\\io\\netty\\netty-common\\4.1.108.Final\\netty-common-4.1.108.Final.jar\\E, ^/META-INF/native-image/, --exclude-config, \\QC:\\Users\\Lahoucine, EL, ADDALI\\.m2\\repository\\io\\netty\\netty-buffer\\4.1.108.Final\\netty-buffer-4.1.108.Final.jar\\E, ^/META-INF/native-image/, --exclude-config, \\QC:\\Users\\Lahoucine, EL, ADDALI\\.m2\\repository\\io\\netty\\netty-transport\\4.1.108.Final\\netty-transport-4.1.108.Final.jar\\E, ^/META-INF/native-image/, --exclude-config, \\QC:\\Users\\Lahoucine, EL, ADDALI\\.m2\\repository\\io\\netty\\netty-codec-http\\4.1.108.Final\\netty-codec-http-4.1.108.Final.jar\\E, ^/META-INF/native-image/, -H:ConfigurationFileDirectories=/home/app/generateResourceConfig,/home/app/generateTestResourceConfig]
[INFO] Using BASE_IMAGE_RUN: cgr.dev/chainguard/wolfi-base:latest
[INFO] Using CLASS_NAME: com.example.Application
[INFO] Step 1/16 : ARG BASE_IMAGE
[INFO]

[INFO] Step 2/16 : ARG BASE_IMAGE_RUN
[INFO]

[INFO] Step 3/16 : FROM ${BASE_IMAGE} AS builder
[INFO]

[INFO]  ---> d4837dfb86a3

[INFO] Step 4/16 : WORKDIR /home/app
[INFO]

[INFO]  ---> Using cache

[INFO]  ---> d33f168d2c67

[INFO] Step 5/16 : COPY classes /home/app/classes
[INFO]

[INFO]  ---> 212dc5617046

[INFO] Step 6/16 : COPY dependency/* /home/app/libs/
[INFO]

[INFO]  ---> 265fdf8da9f7

[INFO] Step 7/16 : COPY graalvm-reachability-metadat[a] /home/app/graalvm-reachability-metadata
[INFO]

[INFO]  ---> 0c1dbe78ee4b

[INFO] Step 8/16 : COPY nativ[e]/generated /home/app/
[INFO]

[INFO]  ---> ff5314f4909c

[INFO] Step 9/16 : COPY *.args /home/app/graalvm-native-image.args
[INFO]

[INFO]  ---> 4d89308b2683

[INFO] Step 10/16 : ARG CLASS_NAME
[INFO]

[INFO]  ---> Running in e6ba9b89e1f9

[INFO] Removing intermediate container e6ba9b89e1f9

[INFO]  ---> 6ebc307fa459

[INFO] Step 11/16 : RUN native-image @/home/app/graalvm-native-image.args -H:Class=${CLASS_NAME} -H:Name=application -cp "/home/app/libs/*:/home/app/classes/"
[INFO]

[INFO]  ---> Running in 8bcc1b709805

[INFO] Error: Found unrecognized options while parsing argument file '/home/app/graalvm-native-image.args':
ADDALI\\\\.m2\\\\repository\\\\io\\\\netty\\\\netty-codec-http2\\\\4.1.108.Final\\\\netty-codec-http2-4.1.108.Final.jar\\\\E
^/META-INF/native-image/
ADDALI\\\\.m2\\\\repository\\\\io\\\\netty\\\\netty-handler\\\\4.1.108.Final\\\\netty-handler-4.1.108.Final.jar\\\\E
^/META-INF/native-image/
ADDALI\\\\.m2\\\\repository\\\\io\\\\netty\\\\netty-common\\\\4.1.108.Final\\\\netty-common-4.1.108.Final.jar\\\\E
^/META-INF/native-image/
ADDALI\\\\.m2\\\\repository\\\\io\\\\netty\\\\netty-buffer\\\\4.1.108.Final\\\\netty-buffer-4.1.108.Final.jar\\\\E
^/META-INF/native-image/
ADDALI\\\\.m2\\\\repository\\\\io\\\\netty\\\\netty-transport\\\\4.1.108.Final\\\\netty-transport-4.1.108.Final.jar\\\\E
^/META-INF/native-image/
ADDALI\\\\.m2\\\\repository\\\\io\\\\netty\\\\netty-codec-http\\\\4.1.108.Final\\\\netty-codec-http-4.1.108.Final.jar\\\\E
^/META-INF/native-image/

[ERROR] The command '/bin/sh -c native-image @/home/app/graalvm-native-image.args -H:Class=${CLASS_NAME} -H:Name=application -cp "/home/app/libs/*:/home/app/classes/"' returned a non-zero code: 20
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for users 1.0-SNAPSHOT:
[INFO]
[INFO] users .............................................. SUCCESS [  0.003 s]
[INFO] lib ................................................ SUCCESS [  1.282 s]
[INFO] users-gcp .......................................... FAILURE [ 18.466 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  21.710 s
[INFO] Finished at: 2024-05-07T13:43:52+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.micronaut.maven:micronaut-maven-plugin:4.5.2:docker-native (default-docker-native) on project gcp: Execution default-docker-native of goal io.micronaut.maven:micronaut-maven-plugin:4.5.2:docker-native failed: Could not build image: The command '/bin/sh -c native-image @/home/app/graalvm-native-image.args -H:Class=${CLASS_NAME} -H:Name=application -cp "/home/app/libs/*:/home/app/classes/"' returned a non-zero code: 20 -> [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/PluginExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :gcp
houcine7 commented 2 months ago

Currently I'm working with this workaround by setting the maven local repository location to the public folder which doesn't contain any white space.