NOTE: For options that can be set using command-line, if both DSL and command-line options are present, command-line options take precedence.
175
175
176
176
[[long_classpath_and_fat_jar_support]]
177
-
==== Long classpath and fat jar support
177
+
==== Long classpath, @argument file and fat jar support
178
178
179
-
Under Windows, https://.com/graalvm/native-build-tools/issues/85[it is possible that the length of the classpath exceeds what the operating system supports] when invoking the CLI to build a native image.
180
-
As a consequence, if you are running under Windows, the plugin will automatically shorten the classpath of your project by building a so called "fat jar", which includes all entries from the classpath automatically.
179
+
Since release 0.9.10, the plugin will automatically pass arguments to the `native-image` tool using an argument file, which should prevent all https://.com/graalvm/native-build-tools/issues/85[long classpath issues] under Windows.
180
+
However, if you are using an older GraalVM release (older than 21.3) which doesn't support argument files, you will need to rely on creating a "fat jar", which includes all entries from the classpath automatically, to workaround the problem:
181
181
182
-
In case this behavior is not required, you can disable the fat jar creation by calling:
Alternatively, it is possible to use your own fat jar (for example created using the https://imperceptiblethoughts.com/shadow/[Shadow plugin]) by setting the `classpathJar` property directly on the _task_:
@@ -24,11 +24,13 @@ If you are interested in contributing, please refer to our https://.com/gr
24
24
* Fixed race condition which prevented the agent files to be generated properly if tests were executed concurrently
25
25
* Documented version compatibility for the JUnit Platform and Maven Surefire plugin.
26
26
- See <<maven-plugin.adoc#testing-support-version-compatibility, Version compatibility>> for details.
27
+
* Add support for long classpath by using an argument file when invoking `native-image`
27
28
28
29
==== Gradle plugin
29
30
30
31
* Fixed `nativeRun` not working properly under Windows
31
32
* Fixed race condition which prevented the agent files to be generated properly if tests were executed concurrently
33
+
* Add support for long classpath by using an argument file when invoking `native-image`
32
34
33
35
=== Release 0.9.9
34
36
Original file line number
Diff line number
Diff line change
@@ -258,11 +258,15 @@ use cases such as the following:
258
258
wish to run those same tests in native mode.
259
259
260
260
[[long_classpath_and_shading_support]]
261
-
== Long classpath and shading support
261
+
== Long classpath, @argument file and shading support
262
262
263
263
Under Windows, https://.com/graalvm/native-build-tools/issues/85[it is possible that the length of the classpath exceeds what the operating system supports] when invoking the CLI to build a native image.
264
264
265
-
If this happens, one option is to use a https://maven.apache.org/plugins/maven-shade-plugin[shaded jar] and use it instead of individual jars on classpath.
265
+
To avoid this, since release 0.9.10, the plugin will use an argument file to pass the arguments to the `native-image` tool, instead of passing them directly.
266
+
267
+
In case you are using a GraalVM version older than 21.3, you will however have to use a workaround, since the argument file wasn't supported.
268
+
269
+
One option is to use a https://maven.apache.org/plugins/maven-shade-plugin[shaded jar] and use it instead of individual jars on classpath.
266
270
267
271
First, you'll need to setup the https://maven.apache.org/plugins/maven-shade-plugin[Maven Shade plugin]:
268
272
Original file line number
Diff line number
Diff line change
@@ -98,15 +98,16 @@ graalvmNative {
98
98
}
99
99
// end::all-config-options[]
100
100
101
-
// tag::disable-fatjar[]
101
+
// tag::enable-fatjar[]
102
102
graalvmNative {
103
+
useArgFile =false// required for older GraalVM releases
103
104
binaries {
104
105
main {
105
-
useFatJar =false
106
+
useFatJar =true
106
107
}
107
108
}
108
109
}
109
-
// end::disable-fatjar[]
110
+
// end::enable-fatjar[]
110
111
111
112
def myFatJar = tasks.register("myFatJar", Jar)
112
113
Original file line number
Diff line number
Diff line change
@@ -99,15 +99,16 @@ graalvmNative {
99
99
}
100
100
// end::all-config-options[]
101
101
102
-
// tag::disable-fatjar[]
102
+
// tag::enable-fatjar[]
103
103
graalvmNative {
104
+
useFatJar.set(false) // required for older GraalVM releases
104
105
binaries {
105
106
named("main") {
106
-
useFatJar.set(false)
107
+
useFatJar.set(true)
107
108
}
108
109
}
109
110
}
110
-
// end::disable-fatjar[]
111
+
// end::enable-fatjar[]
111
112
112
113
val myFatJar = tasks.register<Jar>("myFatJar")
113
114
Original file line number
Diff line number
Diff line change
@@ -171,6 +171,7 @@ public void apply(Project project) {
0 commit comments