try to made devtools work, add some spring-graalvm-native properties

This commit is contained in:
Antoine 2020-08-19 01:21:06 +02:00
parent ee313e09bd
commit 1484b129b9
Signed by: antoine
GPG Key ID: 098FB66FC0475E70
5 changed files with 29 additions and 8 deletions

View File

@ -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

View File

@ -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.
```

16
pom.xml
View File

@ -135,19 +135,19 @@
<artifactId>native-image-maven-plugin</artifactId>
<version>${native-image-maven-plugin.version}</version>
<configuration>
<!-- doc here : https://repo.spring.io/milestone/org/springframework/experimental/spring-graalvm-native-docs/0.7.1/spring-graalvm-native-docs-0.7.1.zip!/reference/index.html#options -->
<buildArgs>
-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
<!-- -H:+ReportExceptionStackTraces-->
<!-- reduce build time and memory -->
<!-- -H:+RemoveSaturatedTypeFlows-->
--allow-incomplete-classpath
--report-unsupported-elements-at-runtime
-H:+ReportExceptionStackTraces
--no-fallback
--no-server
--initialize-at-build-time=org.springframework.boot.validation.MessageInterpolatorFactory
--verbose
<!-- &#45;&#45;initialize-at-build-time=org.springframework.boot.validation.MessageInterpolatorFactory-->
-J-Xmx3G --static
</buildArgs>
<imageName>${project.artifactId}</imageName>

View File

@ -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

View File

@ -3,5 +3,10 @@
"name": "org.springframework.boot.devtools.logger.DevToolsLogFactory.Listener",
"allDeclaredConstructors": true,
"allDeclaredMethods": true
},
{
"name": "javax.validation.ValidationException",
"allDeclaredConstructors": true,
"allDeclaredMethods": true
}
]