From 1484b129b9ebcf865e6241bb98c58016bd2d6e87 Mon Sep 17 00:00:00 2001 From: Antoine Date: Wed, 19 Aug 2020 01:21:06 +0200 Subject: [PATCH] try to made devtools work, add some spring-graalvm-native properties --- Dockerfile | 1 + issue.md | 7 +++++++ pom.xml | 16 ++++++++-------- .../native-image/native-image.properties | 8 ++++++++ .../META-INF/native-image/reflect-config.json | 5 +++++ 5 files changed, 29 insertions(+), 8 deletions(-) create mode 100644 src/main/resources/META-INF/native-image/native-image.properties diff --git a/Dockerfile b/Dockerfile index 86302a6..b531e2a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,6 +21,7 @@ RUN ./mvnw -Pgraal compile # generate graalvm image into another layer RUN ./mvnw -Pgraal package +#FROM debian:buster FROM scratch COPY --from=builder /build/target/wikiProject /wikiproject COPY --from=builder /tmp /tmp diff --git a/issue.md b/issue.md index ff9c97d..f312d12 100644 --- a/issue.md +++ b/issue.md @@ -80,3 +80,10 @@ make: *** [Makefile:22: docker-graal-run] Error 1 Warning: class initialization of class org.springframework.boot.validation.MessageInterpolatorFactory failed with exception java.lang.NoClassDefFoundError: javax/validation/ValidationException. This class will be initialized at run time because option --allow-incomplete-classpath is used for image building. Use the option --initialize-at-run-time=org.springframework.boot.validation.MessageInterpolatorFactory to explicitly request delayed initialization of this class. Number of types dynamically registered for reflective access: #2024 ``` + + ## error class not found + + ``` +WARNING: Could not resolve org.springframework.boot.devtools.logger.DevToolsLogFactory.Listener for reflection configuration. +WARNING: Could not resolve javax.validation.ValidationException for reflection configuration. +``` diff --git a/pom.xml b/pom.xml index 44a004a..d56e315 100644 --- a/pom.xml +++ b/pom.xml @@ -135,19 +135,19 @@ native-image-maven-plugin ${native-image-maven-plugin.version} + - -Dspring.graal.mode=initialization-only - -Dspring.graal.dump-config=/tmp/computed-reflect-config.json - -Dspring.graal.verbose=true - -Dspring.graal.skip-logback=true - -Dspring.graal.remove-unused-autoconfig=true + -H:+PrintAnalysisCallTree -H:+TraceClassInitialization - --no-fallback + + + --allow-incomplete-classpath --report-unsupported-elements-at-runtime - -H:+ReportExceptionStackTraces + --no-fallback --no-server - --initialize-at-build-time=org.springframework.boot.validation.MessageInterpolatorFactory + --verbose + -J-Xmx3G --static ${project.artifactId} diff --git a/src/main/resources/META-INF/native-image/native-image.properties b/src/main/resources/META-INF/native-image/native-image.properties new file mode 100644 index 0000000..3264d5e --- /dev/null +++ b/src/main/resources/META-INF/native-image/native-image.properties @@ -0,0 +1,8 @@ +Args=\ + -Dspring.native.mode=feature \ + -Dspring.native.verbose=true \ + -Dspring.native.dump-config=/tmp/computed-reflect-config.json \ + -Dspring.native.remove-unused-autoconfig=true + +# -H:ReflectionConfigurationResources=${.}/reflect-config.json +# -Dspring.graal.skip-logback=true diff --git a/src/main/resources/META-INF/native-image/reflect-config.json b/src/main/resources/META-INF/native-image/reflect-config.json index d387473..a1407ea 100644 --- a/src/main/resources/META-INF/native-image/reflect-config.json +++ b/src/main/resources/META-INF/native-image/reflect-config.json @@ -3,5 +3,10 @@ "name": "org.springframework.boot.devtools.logger.DevToolsLogFactory.Listener", "allDeclaredConstructors": true, "allDeclaredMethods": true + }, + { + "name": "javax.validation.ValidationException", + "allDeclaredConstructors": true, + "allDeclaredMethods": true } ]