Skip to content

Commit 3913b1c

Browse files
committed
mvn: Tests for remote repo and docs
1 parent a8c0b51 commit 3913b1c

File tree

6 files changed

+80
-22
lines changed

6 files changed

+80
-22
lines changed

docs/src/docs/asciidoc/maven-plugin.adoc

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -556,9 +556,6 @@ command-line argument to Maven as follows. See the documentation for
556556
mvn -Pnative -Dagent=true -DagentOptions=periodic-config test
557557
```
558558

559-
WARNING: If the agent is enabled, the `--allow-incomplete-classpath` option is
560-
automatically added to your native build options.
561-
562559
[[agent-support-running-application]]
563560
=== Running your application with the agent
564561

@@ -595,19 +592,18 @@ mvn -Pnative -Dagent=true -DskipTests package exec:exec@native
595592
[[metadata-support]]
596593
== GraalVM Reachability Metadata Support
597594

598-
Since release 0.9.12, the plugin adds experimental support for the https://github.com/oracle/graalvm-reachability-metadata/[GraalVM reachability metadata repository].
595+
Since release 0.9.12, the plugin adds support for the https://github.com/oracle/graalvm-reachability-metadata/[GraalVM reachability metadata repository].
599596
This repository provides https://www.graalvm.org/22.2/reference-manual/native-image/ReachabilityMetadata/[reachability metadata] for libraries that do not support GraalVM Native Image.
600597

601598
=== Enabling the metadata repository
602599

603-
Support needs to be enabled explicitly:
600+
Support needs to be enabled explicitly by including the following into the `<configuration>` element:
604601

605602
.Enabling the metadata repository
606603
[source,xml,indent=0]
607604
----
608-
include::../../../../samples/native-config-integration/pom.xml[tag=metadata-default]
605+
include::../../../../samples/metadata-repo-integration/pom.xml[tag=metadata-default]
609606
----
610-
<1> The local path can point to an _exploded_ directory, or to a compressed ZIP file.
611607

612608
Alternatively, you can use a _remote repository_, in which case you can specify the URL of the ZIP file:
613609

@@ -617,9 +613,27 @@ Alternatively, you can use a _remote repository_, in which case you can specify
617613
include::../../../../samples/native-config-integration/pom.xml[tag=metadata-url]
618614
----
619615

616+
For debugging purposes you can use a local repository:
617+
618+
.Enabling a local repository
619+
[source,xml,indent=0]
620+
----
621+
include::../../../../samples/native-config-integration/pom.xml[tag=metadata-local]
622+
----
623+
<1> The local path can point to an _exploded_ directory, or to a compressed ZIP file.
624+
620625
=== Configuring the metadata repository
621626

622-
Once activated, for each library included in the native image, the plugin will automatically search for GraalVM reachability metadata in the repository.
627+
Once activated, for each library included in the native image, the plugin will automatically search for GraalVM reachability metadata in the repository that was released together with the plugin.
628+
In case you want to use another verion of the metadata use:
629+
630+
.Choosing a version for the metadata repository
631+
[source,xml,indent=0]
632+
----
633+
include::../../../../samples/metadata-repo-integration/pom.xml[tag=metadata-versioned]
634+
----
635+
636+
623637
In some cases, you may need to exclude a particular module from the search.
624638
This can be done by configuring that particular dependency:
625639

native-gradle-plugin/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ End-user documentation about the plugins can be found [here](https://graalvm.git
77
## Building
88
Building of plugin itself should be as simple as:
99
```bash
10-
./gradlew publishToMavenLocal
10+
./gradlew publishToMavenLocal --no-parallel
1111
```
1212

1313
In order to run testing part of this plugin you need to get (or build) corresponding `junit-platform-native` artifact.

native-maven-plugin/src/functionalTest/groovy/org/graalvm/buildtools/maven/OfficialMetadataRepositoryFunctionalTest.groovy

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,21 @@ class OfficialMetadataRepositoryFunctionalTest extends AbstractGraalVMMavenFunct
5858
and: "finds metadata in the remote repository"
5959
outputContains "[graalvm reachability metadata repository for com.h2database:h2:2.1.210]: Configuration directory is com.h2database/h2/2.1.210"
6060
}
61+
62+
void "the application runs when using the versioned official metadata repository"() {
63+
given:
64+
withSample("metadata-repo-integration")
65+
66+
when:
67+
mvn '-PnativeVersioned', '-DskipTests', 'package', 'exec:exec@native'
68+
69+
then:
70+
buildSucceeded
71+
72+
and: "the run succeeded and retrieved data from the database"
73+
outputContains "Customers in the database"
74+
75+
and: "finds metadata in the remote repository"
76+
outputContains "[graalvm reachability metadata repository for com.h2database:h2:2.1.210]: Configuration directory is com.h2database/h2/2.1.210"
77+
}
6178
}

samples/java-application-with-reflection/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ graalvmNative {
8484
binaries {
8585
test {
8686
verbose = true
87-
buildArgs('--allow-incomplete-classpath')
8887
}
8988
}
9089
}

samples/metadata-repo-integration/pom.xml

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,19 +86,47 @@
8686
</execution>
8787
</executions>
8888
<configuration>
89-
<skip>false</skip>
90-
<imageName>${imageName}</imageName>
91-
<fallback>false</fallback>
89+
<!-- tag::metadata-default[] -->
9290
<metadataRepository>
9391
<enabled>true</enabled>
9492
</metadataRepository>
93+
<!-- end::metadata-default[] -->
94+
</configuration>
95+
</plugin>
96+
</plugins>
97+
</build>
98+
</profile>
99+
<profile>
100+
<id>nativeVersioned</id>
101+
<build>
102+
<plugins>
103+
<plugin>
104+
<groupId>org.graalvm.buildtools</groupId>
105+
<artifactId>native-maven-plugin</artifactId>
106+
<version>${native.maven.plugin.version}</version>
107+
<extensions>true</extensions>
108+
<executions>
109+
<execution>
110+
<id>build-native</id>
111+
<goals>
112+
<goal>build</goal>
113+
</goals>
114+
<phase>package</phase>
115+
</execution>
116+
</executions>
117+
<configuration>
118+
<!-- tag::metadata-versioned[] -->
119+
<metadataRepository>
120+
<enabled>true</enabled>
121+
<version>0.1.0</version>
122+
</metadataRepository>
123+
<!-- end::metadata-versioned[] -->
95124
</configuration>
96125
</plugin>
97126
</plugins>
98127
</build>
99128
</profile>
100129
</profiles>
101-
102130
<build>
103131
<finalName>${project.artifactId}</finalName>
104132
<plugins>

samples/native-config-integration/pom.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,19 +151,19 @@
151151
<id>metadataLocal</id>
152152
<build>
153153
<plugins>
154-
<!-- tag::metadata-local[] -->
155154
<plugin>
156155
<groupId>org.graalvm.buildtools</groupId>
157156
<artifactId>native-maven-plugin</artifactId>
158157
<version>${native.maven.plugin.version}</version>
159158
<configuration>
159+
<!-- tag::metadata-local[] -->
160160
<metadataRepository>
161161
<enabled>true</enabled>
162162
<localPath>${project.basedir}/config-directory</localPath> <!--1-->
163163
</metadataRepository>
164+
<!-- end::metadata-local[] -->
164165
</configuration>
165166
</plugin>
166-
<!-- end::metadata-local[] -->
167167
</plugins>
168168
</build>
169169
</profile>
@@ -227,12 +227,12 @@
227227
<id>metadataExclude</id>
228228
<build>
229229
<plugins>
230-
<!-- tag::metadata-exclude[] -->
231230
<plugin>
232231
<groupId>org.graalvm.buildtools</groupId>
233232
<artifactId>native-maven-plugin</artifactId>
234233
<version>${native.maven.plugin.version}</version>
235234
<configuration>
235+
<!-- tag::metadata-exclude[] -->
236236
<metadataRepository>
237237
<enabled>true</enabled>
238238
<localPath>${project.basedir}/config-directory</localPath>
@@ -244,23 +244,23 @@
244244
</dependency>
245245
</dependencies>
246246
</metadataRepository>
247+
<!-- end::metadata-exclude[] -->
247248
</configuration>
248249
</plugin>
249-
<!-- end::metadata-exclude[] -->
250250
</plugins>
251251
</build>
252252
</profile>
253253
<profile>
254254
<id>metadataForceVersion</id>
255255
<build>
256256
<plugins>
257-
<!-- tag::metadata-force-version[] -->
258257
<plugin>
259258
<groupId>org.graalvm.buildtools</groupId>
260259
<artifactId>native-maven-plugin</artifactId>
261260
<version>${native.maven.plugin.version}</version>
262261
<configuration>
263262
<useArgFile>false</useArgFile>
263+
<!-- tag::metadata-force-version[] -->
264264
<metadataRepository>
265265
<enabled>true</enabled>
266266
<localPath>${project.basedir}/config-directory</localPath>
@@ -272,9 +272,9 @@
272272
</dependency>
273273
</dependencies>
274274
</metadataRepository>
275+
<!-- end::metadata-force-version[] -->
275276
</configuration>
276277
</plugin>
277-
<!-- end::metadata-force-version[] -->
278278
</plugins>
279279
</build>
280280
</profile>
@@ -341,20 +341,20 @@
341341
</execution>
342342
</executions>
343343
</plugin>
344-
<!-- tag::metadata-url[] -->
345344
<plugin>
346345
<groupId>org.graalvm.buildtools</groupId>
347346
<artifactId>native-maven-plugin</artifactId>
348347
<version>${native.maven.plugin.version}</version>
349348
<configuration>
350349
<useArgFile>false</useArgFile>
350+
<!-- tag::metadata-url[] -->
351351
<metadataRepository>
352352
<enabled>true</enabled>
353353
<url>${metadata.url}</url>
354354
</metadataRepository>
355+
<!-- end::metadata-url[] -->
355356
</configuration>
356357
</plugin>
357-
<!-- end::metadata-url[] -->
358358
</plugins>
359359
</build>
360360
</profile>

0 commit comments

Comments
 (0)