GraalVM native-image Signed-off-by: Maxim Nesen <maxim.nesen@oracle.com>
diff --git a/.gitignore b/.gitignore index 9f7d5b9..9d011f0 100644 --- a/.gitignore +++ b/.gitignore
@@ -1,6 +1,7 @@ # maven noise target/ target-*/ +target*/ # gradle noise .gradle
diff --git a/containers/grizzly2-http/src/main/resources/META-INF/native-image/org.glassfish.jersey.containers/jersey-container-grizzly2-http/reflect-config.json b/containers/grizzly2-http/src/main/resources/META-INF/native-image/org.glassfish.jersey.containers/jersey-container-grizzly2-http/reflect-config.json new file mode 100644 index 0000000..6ababc4 --- /dev/null +++ b/containers/grizzly2-http/src/main/resources/META-INF/native-image/org.glassfish.jersey.containers/jersey-container-grizzly2-http/reflect-config.json
@@ -0,0 +1,39 @@ +[ +{ + "name":"org.glassfish.grizzly.Buffer[]" +}, +{ +"name":"org.glassfish.grizzly.ConnectionProbe[]" +}, +{ +"name":"org.glassfish.grizzly.IOEventLifeCycleListener[]" +}, +{ +"name":"org.glassfish.grizzly.TransportProbe[]" +}, +{ +"name":"org.glassfish.grizzly.http.HttpProbe[]" +}, +{ +"name":"org.glassfish.grizzly.http.TransferEncoding[]" +}, +{ +"name":"org.glassfish.grizzly.http.server.HttpServerProbe[]" +}, +{ +"name":"org.glassfish.grizzly.http.server.TagLocaleParser", +"methods":[{"name":"<init>","parameterTypes":[] }] +}, +{ +"name":"org.glassfish.grizzly.http.server.filecache.FileCacheProbe[]" +}, +{ +"name":"org.glassfish.grizzly.memory.MemoryProbe[]" +}, +{ +"name":"org.glassfish.grizzly.threadpool.ThreadPoolProbe[]" +}, +{ +"name":"org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainerProvider" +} +] \ No newline at end of file
diff --git a/core-common/src/main/resources/META-INF/native-image/org.glassfish.jersey.core/jersey-common/reflect-config.json b/core-common/src/main/resources/META-INF/native-image/org.glassfish.jersey.core/jersey-common/reflect-config.json new file mode 100644 index 0000000..9ea23c8 --- /dev/null +++ b/core-common/src/main/resources/META-INF/native-image/org.glassfish.jersey.core/jersey-common/reflect-config.json
@@ -0,0 +1,153 @@ +[ + { + "name":"org.glassfish.jersey.internal.config.ExternalPropertiesAutoDiscoverable", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.glassfish.jersey.internal.inject.Custom", + "allDeclaredMethods":true + }, + { + "name":"org.glassfish.jersey.internal.ServiceFinder", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.glassfish.jersey.logging.LoggingFeatureAutoDiscoverable", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.glassfish.jersey.message.internal.AbstractFormProvider", + "allDeclaredFields":true, + "allDeclaredMethods":true + }, + { + "name":"org.glassfish.jersey.message.internal.AbstractMessageReaderWriterProvider", + "allDeclaredFields":true, + "allDeclaredMethods":true + }, + { + "name":"org.glassfish.jersey.message.internal.BasicTypesMessageProvider", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.glassfish.jersey.message.internal.ByteArrayProvider", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.glassfish.jersey.message.internal.DataSourceProvider", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.glassfish.jersey.message.internal.EnumMessageProvider", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allPublicMethods":true, + "allDeclaredConstructors":true, + "allPublicConstructors":true + }, + { + "name":"org.glassfish.jersey.message.internal.FileProvider", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.glassfish.jersey.message.internal.FormMultivaluedMapProvider", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.glassfish.jersey.message.internal.FormProvider", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.glassfish.jersey.message.internal.InputStreamProvider", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.glassfish.jersey.message.internal.ReaderProvider", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.glassfish.jersey.message.internal.RenderedImageProvider", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.glassfish.jersey.message.internal.SourceProvider$DomSourceReader", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.glassfish.jersey.message.internal.SourceProvider$SaxSourceReader", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.glassfish.jersey.message.internal.SourceProvider$SourceWriter", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.glassfish.jersey.message.internal.SourceProvider$StreamSourceReader", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.glassfish.jersey.message.internal.StreamingOutputProvider", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.glassfish.jersey.message.internal.StringMessageProvider", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.glassfish.jersey.process.Inflector", + "methods":[{"name":"apply","parameterTypes":["java.lang.Object"] }] + }, + { + "name":"org.glassfish.jersey.process.internal.RequestScope", + "allDeclaredFields":true, + "allDeclaredMethods":true + }, + { + "name":"org.glassfish.jersey.spi.AbstractThreadPoolProvider", + "allDeclaredMethods":true + }, + { + "name":"org.glassfish.jersey.spi.ScheduledThreadPoolExecutorProvider", + "allDeclaredMethods":true + }, + { + "name":"org.glassfish.jersey.spi.ThreadPoolExecutorProvider", + "allDeclaredMethods":true + } +] \ No newline at end of file
diff --git a/core-common/src/main/resources/META-INF/native-image/org.glassfish.jersey.core/jersey-common/resource-config.json b/core-common/src/main/resources/META-INF/native-image/org.glassfish.jersey.core/jersey-common/resource-config.json new file mode 100644 index 0000000..462f993 --- /dev/null +++ b/core-common/src/main/resources/META-INF/native-image/org.glassfish.jersey.core/jersey-common/resource-config.json
@@ -0,0 +1,5 @@ +{ + "bundles": [ + {"name": "org.glassfish.jersey.internal.localization"} + ] +} \ No newline at end of file
diff --git a/core-server/src/main/resources/META-INF/native-image/org.glassfish.jersey.core/jersey-server/reflect-config.json b/core-server/src/main/resources/META-INF/native-image/org.glassfish.jersey.core/jersey-server/reflect-config.json new file mode 100644 index 0000000..f013c36 --- /dev/null +++ b/core-server/src/main/resources/META-INF/native-image/org.glassfish.jersey.core/jersey-server/reflect-config.json
@@ -0,0 +1,91 @@ +[ + { + "name":"org.glassfish.jersey.server.BackgroundScheduler", + "allDeclaredMethods":true + }, + { + "name":"org.glassfish.jersey.server.ChunkedResponseWriter", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.glassfish.jersey.server.ManagedAsyncExecutor", + "allDeclaredMethods":true + }, + { + "name":"org.glassfish.jersey.server.ResourceConfig", + "allDeclaredMethods":true + }, + { + "name":"org.glassfish.jersey.server.ServerExecutorProvidersConfigurator$DefaultBackgroundSchedulerProvider", + "allDeclaredMethods":true + }, + { + "name":"org.glassfish.jersey.server.ServerExecutorProvidersConfigurator$DefaultManagedAsyncExecutorProvider", + "allDeclaredMethods":true + }, + { + "name":"org.glassfish.jersey.server.filter.internal.ServerFiltersAutoDiscoverable", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.glassfish.jersey.server.internal.JsonWithPaddingInterceptor", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.glassfish.jersey.server.internal.monitoring.MonitoringAutodiscoverable", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.glassfish.jersey.server.internal.monitoring.MonitoringContainerListener", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.glassfish.jersey.server.internal.process.RequestProcessingContextReference", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.glassfish.jersey.server.model.Parameter$ServerParameterService", + "methods":[{"name":"<init>","parameterTypes":[] }] + }, + { + "name":"org.glassfish.jersey.server.wadl.WadlFeature", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allPublicMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.glassfish.jersey.server.wadl.internal.WadlAutoDiscoverable", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.glassfish.jersey.server.wadl.processor.OptionsMethodProcessor$GenericOptionsInflector", + "allPublicMethods":true, + "allPublicConstructors":true + }, + { + "name":"org.glassfish.jersey.server.wadl.processor.OptionsMethodProcessor$PlainTextOptionsInflector", + "allPublicMethods":true, + "allPublicConstructors":true + } +] \ No newline at end of file
diff --git a/core-server/src/main/resources/META-INF/native-image/org.glassfish.jersey.core/jersey-server/resource-config.json b/core-server/src/main/resources/META-INF/native-image/org.glassfish.jersey.core/jersey-server/resource-config.json new file mode 100644 index 0000000..6615ca3 --- /dev/null +++ b/core-server/src/main/resources/META-INF/native-image/org.glassfish.jersey.core/jersey-server/resource-config.json
@@ -0,0 +1,5 @@ +{ + "bundles": [ + {"name":"org.glassfish.jersey.server.internal.localization"} + ] +} \ No newline at end of file
diff --git a/examples/helloworld-cdi2-se/src/main/java/org/glassfish/jersey/examples/helloworld/cdi2se/App.java b/examples/helloworld-cdi2-se/src/main/java/org/glassfish/jersey/examples/helloworld/cdi2se/App.java index 5608a6d..3ad314e 100644 --- a/examples/helloworld-cdi2-se/src/main/java/org/glassfish/jersey/examples/helloworld/cdi2se/App.java +++ b/examples/helloworld-cdi2-se/src/main/java/org/glassfish/jersey/examples/helloworld/cdi2se/App.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2019 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2021 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -40,7 +40,7 @@ server.start(); System.out.println("Application started.\nTry out"); - System.out.println(String.format("%s%s%s", BASE_URI, ROOT_HELLO_PATH, "/Some%Name")); + System.out.println(String.format("%s%s%s", BASE_URI, ROOT_HELLO_PATH, "/Some%20Name")); System.out.println(String.format("%s%s%s", BASE_URI, ROOT_COUNTER_PATH, "/request")); System.out.println(String.format("%s%s%s", BASE_URI, ROOT_COUNTER_PATH, "/application")); System.out.println("Stop the application using CTRL+C");
diff --git a/examples/helloworld-programmatic/pom.xml b/examples/helloworld-programmatic/pom.xml index 6e49ed3..91b03d2 100644 --- a/examples/helloworld-programmatic/pom.xml +++ b/examples/helloworld-programmatic/pom.xml
@@ -67,6 +67,51 @@ </plugins> </build> </profile> + <profile> + <id>native-image</id> + <build> + <plugins> + <plugin> + <groupId>org.graalvm.nativeimage</groupId> + <artifactId>native-image-maven-plugin</artifactId> + <version>${graalvm.version}</version> + <executions> + <execution> + <goals> + <goal>native-image</goal> + </goals> + <phase>package</phase> + </execution> + </executions> + <configuration> + <imageName>${project.artifactId}-native</imageName> + <mainClass>org.glassfish.jersey.examples.helloworld.App</mainClass> + </configuration> + </plugin> + </plugins> + </build> + <dependencies> + + <dependency> + <groupId>jakarta.activation</groupId> + <artifactId>jakarta.activation-api</artifactId> + <version>${jakarta.activation.version}</version> + </dependency> + <dependency> + <groupId>jakarta.xml.bind</groupId> + <artifactId>jakarta.xml.bind-api</artifactId> + </dependency> + <dependency> + <groupId>org.glassfish.hk2</groupId> + <artifactId>hk2-locator</artifactId> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.framework</artifactId> + <version>${osgi.framework.version}</version> + </dependency> + </dependencies> + </profile> </profiles> </project>
diff --git a/examples/helloworld-programmatic/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld-programmatic/jni-config.json b/examples/helloworld-programmatic/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld-programmatic/jni-config.json new file mode 100644 index 0000000..9127dd4 --- /dev/null +++ b/examples/helloworld-programmatic/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld-programmatic/jni-config.json
@@ -0,0 +1,9 @@ +[ + { + "name":"java.lang.ClassLoader", + "methods":[{"name":"getPlatformClassLoader","parameterTypes":[] }] + }, + { + "name":"java.lang.NoSuchMethodError" + } +]
diff --git a/examples/helloworld-programmatic/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld-programmatic/native-image.properties b/examples/helloworld-programmatic/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld-programmatic/native-image.properties new file mode 100644 index 0000000..6d2c053 --- /dev/null +++ b/examples/helloworld-programmatic/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld-programmatic/native-image.properties
@@ -0,0 +1,16 @@ +# +# Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Distribution License v. 1.0, which is available at +# http://www.eclipse.org/org/documents/edl-v10.php. +# +# SPDX-License-Identifier: BSD-3-Clause +# + +Args=-H:EnableURLProtocols=http,https \ + --initialize-at-build-time=org.glassfish.jersey.client.internal.HttpUrlConnector \ + -H:+ReportExceptionStackTraces \ + --verbose \ + --no-fallback \ + --report-unsupported-elements-at-runtime \ No newline at end of file
diff --git a/examples/helloworld-programmatic/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld-programmatic/reflect-config.json b/examples/helloworld-programmatic/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld-programmatic/reflect-config.json new file mode 100644 index 0000000..90f407d --- /dev/null +++ b/examples/helloworld-programmatic/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld-programmatic/reflect-config.json
@@ -0,0 +1,44 @@ +[ + { + "name":"java.awt.image.RenderedImage" + }, + { + "name":"javax.activation.DataSource" + }, + { + "name":"javax.inject.Singleton", + "allDeclaredMethods":true + }, + { + "name":"javax.ws.rs.core.Application", + "allDeclaredMethods":true + }, + { + "name":"javax.ws.rs.core.Feature", + "methods":[{"name":"configure","parameterTypes":["javax.ws.rs.core.FeatureContext"] }] + }, + { + "name":"javax.xml.transform.Source" + }, + { + "name":"javax.xml.transform.dom.DOMSource" + }, + { + "name":"javax.xml.transform.sax.SAXSource" + }, + { + "name":"javax.xml.transform.stream.StreamSource" + }, + { + "name":"org.glassfish.jersey.examples.helloworld.App$2", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allPublicMethods":true + }, + { + "name":"org.glassfish.jersey.examples.helloworld.App$3", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allPublicMethods":true + } +] \ No newline at end of file
diff --git a/examples/helloworld-programmatic/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld-programmatic/resource-config.json b/examples/helloworld-programmatic/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld-programmatic/resource-config.json new file mode 100644 index 0000000..b247af1 --- /dev/null +++ b/examples/helloworld-programmatic/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld-programmatic/resource-config.json
@@ -0,0 +1,8 @@ +{ + "resources": [ + {"pattern": "org/glassfish/grizzly/version.properties"} + ], + "bundles": [ + {"name":"javax.xml.bind.Messages"} + ] +} \ No newline at end of file
diff --git a/examples/helloworld-pure-jax-rs/pom.xml b/examples/helloworld-pure-jax-rs/pom.xml index c83d3ce..cc10ce5 100644 --- a/examples/helloworld-pure-jax-rs/pom.xml +++ b/examples/helloworld-pure-jax-rs/pom.xml
@@ -70,6 +70,51 @@ </plugins> </build> </profile> + <profile> + <id>native-image</id> + <build> + <plugins> + <plugin> + <groupId>org.graalvm.nativeimage</groupId> + <artifactId>native-image-maven-plugin</artifactId> + <version>${graalvm.version}</version> + <executions> + <execution> + <goals> + <goal>native-image</goal> + </goals> + <phase>package</phase> + </execution> + </executions> + <configuration> + <imageName>${project.artifactId}-native</imageName> + <mainClass>org.glassfish.jersey.examples.helloworld.jaxrs.App</mainClass> + </configuration> + </plugin> + </plugins> + </build> + <dependencies> + + <dependency> + <groupId>jakarta.activation</groupId> + <artifactId>jakarta.activation-api</artifactId> + <version>${jakarta.activation.version}</version> + </dependency> + <dependency> + <groupId>jakarta.xml.bind</groupId> + <artifactId>jakarta.xml.bind-api</artifactId> + </dependency> + <dependency> + <groupId>org.glassfish.hk2</groupId> + <artifactId>hk2-locator</artifactId> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.framework</artifactId> + <version>${osgi.framework.version}</version> + </dependency> + </dependencies> + </profile> </profiles> </project>
diff --git a/examples/helloworld-pure-jax-rs/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld-pure-jax-rs/jni-config.json b/examples/helloworld-pure-jax-rs/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld-pure-jax-rs/jni-config.json new file mode 100644 index 0000000..9127dd4 --- /dev/null +++ b/examples/helloworld-pure-jax-rs/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld-pure-jax-rs/jni-config.json
@@ -0,0 +1,9 @@ +[ + { + "name":"java.lang.ClassLoader", + "methods":[{"name":"getPlatformClassLoader","parameterTypes":[] }] + }, + { + "name":"java.lang.NoSuchMethodError" + } +]
diff --git a/examples/helloworld-pure-jax-rs/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld-pure-jax-rs/native-image.properties b/examples/helloworld-pure-jax-rs/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld-pure-jax-rs/native-image.properties new file mode 100644 index 0000000..6d2c053 --- /dev/null +++ b/examples/helloworld-pure-jax-rs/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld-pure-jax-rs/native-image.properties
@@ -0,0 +1,16 @@ +# +# Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Distribution License v. 1.0, which is available at +# http://www.eclipse.org/org/documents/edl-v10.php. +# +# SPDX-License-Identifier: BSD-3-Clause +# + +Args=-H:EnableURLProtocols=http,https \ + --initialize-at-build-time=org.glassfish.jersey.client.internal.HttpUrlConnector \ + -H:+ReportExceptionStackTraces \ + --verbose \ + --no-fallback \ + --report-unsupported-elements-at-runtime \ No newline at end of file
diff --git a/examples/helloworld-pure-jax-rs/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld-pure-jax-rs/reflect-config.json b/examples/helloworld-pure-jax-rs/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld-pure-jax-rs/reflect-config.json new file mode 100644 index 0000000..ccde28c --- /dev/null +++ b/examples/helloworld-pure-jax-rs/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld-pure-jax-rs/reflect-config.json
@@ -0,0 +1,40 @@ +[ + { + "name":"java.awt.image.RenderedImage" + }, + { + "name":"javax.activation.DataSource" + }, + { + "name":"javax.inject.Singleton", + "allDeclaredMethods":true + }, + { + "name":"javax.ws.rs.core.Application", + "allDeclaredMethods":true + }, + { + "name":"javax.ws.rs.core.Feature", + "methods":[{"name":"configure","parameterTypes":["javax.ws.rs.core.FeatureContext"] }] + }, + { + "name":"javax.xml.transform.Source" + }, + { + "name":"javax.xml.transform.dom.DOMSource" + }, + { + "name":"javax.xml.transform.sax.SAXSource" + }, + { + "name":"javax.xml.transform.stream.StreamSource" + }, + { + "name":"org.glassfish.jersey.examples.helloworld.jaxrs.HelloWorldResource", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allPublicMethods":true, + "allDeclaredConstructors":true, + "allPublicConstructors":true + } +] \ No newline at end of file
diff --git a/examples/helloworld-pure-jax-rs/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld-pure-jax-rs/resource-config.json b/examples/helloworld-pure-jax-rs/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld-pure-jax-rs/resource-config.json new file mode 100644 index 0000000..b247af1 --- /dev/null +++ b/examples/helloworld-pure-jax-rs/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld-pure-jax-rs/resource-config.json
@@ -0,0 +1,8 @@ +{ + "resources": [ + {"pattern": "org/glassfish/grizzly/version.properties"} + ], + "bundles": [ + {"name":"javax.xml.bind.Messages"} + ] +} \ No newline at end of file
diff --git a/examples/helloworld/pom.xml b/examples/helloworld/pom.xml index d3e729b..a75a07d 100644 --- a/examples/helloworld/pom.xml +++ b/examples/helloworld/pom.xml
@@ -26,6 +26,10 @@ <description>Jersey annotated resource class "Hello world" example.</description> + <properties> +<!-- <graalvm.version>21.1.0</graalvm.version>--> + </properties> + <dependencies> <dependency> <groupId>org.glassfish.jersey.containers</groupId> @@ -76,6 +80,49 @@ </plugins> </build> </profile> + <profile> + <id>native-image</id> + <build> + <plugins> + <plugin> + <groupId>org.graalvm.nativeimage</groupId> + <artifactId>native-image-maven-plugin</artifactId> + <version>${graalvm.version}</version> + <executions> + <execution> + <goals> + <goal>native-image</goal> + </goals> + <phase>package</phase> + </execution> + </executions> + <configuration> + <imageName>${project.artifactId}-native</imageName> + <mainClass>org.glassfish.jersey.examples.helloworld.App</mainClass> + </configuration> + </plugin> + </plugins> + </build> + <dependencies> + <dependency> + <groupId>jakarta.activation</groupId> + <artifactId>jakarta.activation-api</artifactId> + <version>${jakarta.activation.version}</version> + </dependency> + <dependency> + <groupId>jakarta.xml.bind</groupId> + <artifactId>jakarta.xml.bind-api</artifactId> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.framework</artifactId> + <version>${osgi.framework.version}</version> + </dependency> + <dependency> + <groupId>org.glassfish.hk2</groupId> + <artifactId>hk2-locator</artifactId> + </dependency> + </dependencies> + </profile> </profiles> - </project>
diff --git a/examples/helloworld/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld/jni-config.json b/examples/helloworld/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld/jni-config.json new file mode 100644 index 0000000..9127dd4 --- /dev/null +++ b/examples/helloworld/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld/jni-config.json
@@ -0,0 +1,9 @@ +[ + { + "name":"java.lang.ClassLoader", + "methods":[{"name":"getPlatformClassLoader","parameterTypes":[] }] + }, + { + "name":"java.lang.NoSuchMethodError" + } +]
diff --git a/examples/helloworld/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld/native-image.properties b/examples/helloworld/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld/native-image.properties new file mode 100644 index 0000000..6d2c053 --- /dev/null +++ b/examples/helloworld/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld/native-image.properties
@@ -0,0 +1,16 @@ +# +# Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Distribution License v. 1.0, which is available at +# http://www.eclipse.org/org/documents/edl-v10.php. +# +# SPDX-License-Identifier: BSD-3-Clause +# + +Args=-H:EnableURLProtocols=http,https \ + --initialize-at-build-time=org.glassfish.jersey.client.internal.HttpUrlConnector \ + -H:+ReportExceptionStackTraces \ + --verbose \ + --no-fallback \ + --report-unsupported-elements-at-runtime \ No newline at end of file
diff --git a/examples/helloworld/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld/reflect-config.json b/examples/helloworld/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld/reflect-config.json new file mode 100644 index 0000000..ce14b8e --- /dev/null +++ b/examples/helloworld/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld/reflect-config.json
@@ -0,0 +1,40 @@ +[ + { + "name":"java.awt.image.RenderedImage" + }, + { + "name":"javax.activation.DataSource" + }, + { + "name":"javax.inject.Singleton", + "allDeclaredMethods":true + }, + { + "name":"javax.ws.rs.core.Application", + "allDeclaredMethods":true + }, + { + "name":"javax.ws.rs.core.Feature", + "methods":[{"name":"configure","parameterTypes":["javax.ws.rs.core.FeatureContext"] }] + }, + { + "name":"javax.xml.transform.Source" + }, + { + "name":"javax.xml.transform.dom.DOMSource" + }, + { + "name":"javax.xml.transform.sax.SAXSource" + }, + { + "name":"javax.xml.transform.stream.StreamSource" + }, + { + "name":"org.glassfish.jersey.examples.helloworld.HelloWorldResource", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allPublicMethods":true, + "allDeclaredConstructors":true, + "allPublicConstructors":true + } +] \ No newline at end of file
diff --git a/examples/helloworld/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld/resource-config.json b/examples/helloworld/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld/resource-config.json new file mode 100644 index 0000000..b247af1 --- /dev/null +++ b/examples/helloworld/src/main/resources/META-INF/native-image/org.glassfish.jersey.examples/helloworld/resource-config.json
@@ -0,0 +1,8 @@ +{ + "resources": [ + {"pattern": "org/glassfish/grizzly/version.properties"} + ], + "bundles": [ + {"name":"javax.xml.bind.Messages"} + ] +} \ No newline at end of file
diff --git a/inject/hk2/src/main/resources/META-INF/native-image/org.glassfish.jersey.inject/jersey-hk2/reflect-config.json b/inject/hk2/src/main/resources/META-INF/native-image/org.glassfish.jersey.inject/jersey-hk2/reflect-config.json new file mode 100644 index 0000000..cb8c35b --- /dev/null +++ b/inject/hk2/src/main/resources/META-INF/native-image/org.glassfish.jersey.inject/jersey-hk2/reflect-config.json
@@ -0,0 +1,68 @@ +[ + { + "name": "org.glassfish.hk2.internal.PerThreadContext", + "allDeclaredFields": true, + "allDeclaredMethods": true, + "allDeclaredConstructors": true + }, + { + "name": "org.glassfish.hk2.osgiresourcelocator.ServiceLoader", + "methods": [{ "name":"lookupProviderClasses", "parameterTypes":["java.lang.Class"] }] + }, + { + "name":"org.glassfish.jersey.inject.hk2.ContextInjectionResolverImpl", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.glassfish.jersey.inject.hk2.Hk2InjectionManagerFactory", + "methods":[{"name":"<init>","parameterTypes":[] }] + }, + { + "name":"org.glassfish.jersey.inject.hk2.Hk2RequestScope", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.glassfish.jersey.inject.hk2.InstanceSupplierFactoryBridge", + "methods":[{"name":"provide","parameterTypes":[] }] + }, + { + "name":"org.glassfish.jersey.inject.hk2.JerseyErrorService", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.glassfish.jersey.inject.hk2.RequestContext", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.jvnet.hk2.internal.ProxyUtilities$4", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.jvnet.hk2.internal.ProxyUtilities", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.jvnet.hk2.internal.DynamicConfigurationServiceImpl", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + }, + { + "name":"org.jvnet.hk2.internal.ServiceLocatorRuntimeImpl", + "allDeclaredFields":true, + "allDeclaredMethods":true, + "allDeclaredConstructors":true + } +] \ No newline at end of file
diff --git a/inject/hk2/src/main/resources/META-INF/native-image/org.glassfish.jersey.inject/jersey-hk2/resource-config.json b/inject/hk2/src/main/resources/META-INF/native-image/org.glassfish.jersey.inject/jersey-hk2/resource-config.json new file mode 100644 index 0000000..1845c39 --- /dev/null +++ b/inject/hk2/src/main/resources/META-INF/native-image/org.glassfish.jersey.inject/jersey-hk2/resource-config.json
@@ -0,0 +1,5 @@ +{ + "bundles": [ + {"name":"org.glassfish.jersey.inject.hk2.localization"} + ] +} \ No newline at end of file
diff --git a/pom.xml b/pom.xml index 5973e47..156cf98 100644 --- a/pom.xml +++ b/pom.xml
@@ -329,7 +329,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> - <version>2.4</version> + <version>3.2.0</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> @@ -446,7 +446,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> - <version>2.8</version> + <version>3.1.2</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> @@ -2132,6 +2132,7 @@ <nexus-staging.mvn.plugin.version>1.6.7</nexus-staging.mvn.plugin.version> <opentracing.version>0.30.0</opentracing.version> <osgi.version>6.0.0</osgi.version> + <osgi.framework.version>1.10.0</osgi.framework.version> <osgi.compendium.version>5.0.0</osgi.compendium.version> <pax.exam.version>4.13.1</pax.exam.version> <pax.web.version>0.7.4</pax.web.version><!-- TODO: UPGRADE! --> @@ -2152,6 +2153,9 @@ <weld3.version>3.1.7.SP1</weld3.version> <xerces.version>2.11.0</xerces.version> + <!-- Graal VM --> + <graalvm.version>20.3.2</graalvm.version> + <!-- do not need CQs --> <gf.impl.version>5.1.0</gf.impl.version> <istack.commons.runtime.version>3.0.8</istack.commons.runtime.version>