Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.

Commit 0ecccee

Browse files
committed
Added doc on imagecode property for agent
1 parent 8db680c commit 0ecccee

File tree

1 file changed

+3
-2
lines changed
  • spring-graalvm-native-docs/src/main/asciidoc

1 file changed

+3
-2
lines changed

spring-graalvm-native-docs/src/main/asciidoc/agent.adoc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ specific and will need tweaking to match the package of a specific applications
4242

4343
The access-filter.json file is specified with the `access-filter-file` option as part of the agentlib string:
4444

45-
`-agentlib:native-image-agent=access-filter-file=access-filter.json,config-output-dir=target/classes/META-INF/native-image`
45+
`-Dorg.graalvm.nativeimage.imagecode=true -agentlib:native-image-agent=access-filter-file=access-filter.json,config-output-dir=target/classes/META-INF/native-image`
4646

47+
Note the inclusion of the `-D` to set the `org.graalvm.nativeimage.imagecode` property. In normal operation a built native executable will have this property set (automatically by the image building process). If there is any code that will behave differently due to it being set (which may occur if trying to work around something not supported by GraalVM) then we should set it when running with the agent too, so that code executed whilst the agent is attached matches the code that will run in the final executable.
4748

4849
=== Using it with maven
4950

@@ -154,4 +155,4 @@ generated configuration.
154155
to give a name to the native-image built executable. Also tweak the `<mainClass>...</mainClass>` to point to the main application class.
155156

156157
Then, running `mvn -Pnative clean package` will do everything from end-to-end. It will compile the app,
157-
run the test with agent attached, finally building the native-image executable.
158+
run the test with agent attached, finally building the native-image executable.

0 commit comments

Comments
 (0)