Fix OSGi headers for CDI & MP Jersey modules to be compatible with EE8 (#5122)

Signed-off-by: jansupol <jan.supol@oracle.com>
diff --git a/ext/bean-validation/pom.xml b/ext/bean-validation/pom.xml
index 00e1ab1..51d88bf 100644
--- a/ext/bean-validation/pom.xml
+++ b/ext/bean-validation/pom.xml
@@ -57,6 +57,7 @@
                         <Export-Package>org.glassfish.jersey.server.validation.*;version=${project.version}</Export-Package>
                         <Import-Package>
                             ${javax.annotation.osgi.version},
+                            ${cdi.osgi.version},
                             javax.validation.*;resolution:=optional;version="${range;[==,3);${javax.validation.api.version}}",
                             *
                         </Import-Package>
diff --git a/ext/cdi/jersey-cdi-rs-inject/pom.xml b/ext/cdi/jersey-cdi-rs-inject/pom.xml
index f974848..705c979 100644
--- a/ext/cdi/jersey-cdi-rs-inject/pom.xml
+++ b/ext/cdi/jersey-cdi-rs-inject/pom.xml
@@ -56,6 +56,20 @@
                     <show>package</show>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <inherited>true</inherited>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Import-Package>
+                            ${cdi.osgi.version},
+                            *
+                        </Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 
diff --git a/ext/cdi/jersey-cdi1x-servlet/pom.xml b/ext/cdi/jersey-cdi1x-servlet/pom.xml
index d6ff4cc..a18ea12 100644
--- a/ext/cdi/jersey-cdi1x-servlet/pom.xml
+++ b/ext/cdi/jersey-cdi1x-servlet/pom.xml
@@ -92,6 +92,10 @@
                 <configuration>
                     <instructions>
                         <Export-Package>org.glassfish.jersey.ext.cdi1x.servlet.internal</Export-Package>
+                        <Import-Package>
+                            ${cdi.osgi.version},
+                            *
+                        </Import-Package>
                     </instructions>
                 </configuration>
             </plugin>
diff --git a/ext/cdi/jersey-cdi1x-transaction/pom.xml b/ext/cdi/jersey-cdi1x-transaction/pom.xml
index b5fa91b..7d78cc0 100644
--- a/ext/cdi/jersey-cdi1x-transaction/pom.xml
+++ b/ext/cdi/jersey-cdi1x-transaction/pom.xml
@@ -91,7 +91,11 @@
                 <configuration>
                     <instructions>
                         <Export-Package>org.glassfish.jersey.ext.cdi1x.transaction.internal</Export-Package>
-                        <Import-Package>${javax.annotation.osgi.version},*</Import-Package>
+                        <Import-Package>
+                            ${javax.annotation.osgi.version},
+                            ${cdi.osgi.version},
+                            *
+                        </Import-Package>
                     </instructions>
                 </configuration>
             </plugin>
diff --git a/ext/cdi/jersey-cdi1x-validation/pom.xml b/ext/cdi/jersey-cdi1x-validation/pom.xml
index b4feba7..85f6771 100644
--- a/ext/cdi/jersey-cdi1x-validation/pom.xml
+++ b/ext/cdi/jersey-cdi1x-validation/pom.xml
@@ -103,7 +103,11 @@
                 <configuration>
                     <instructions>
                         <Export-Package>org.glassfish.jersey.ext.cdi1x.validation.internal;version=${project.version}</Export-Package>
-                        <Import-Package>${javax.annotation.osgi.version},*</Import-Package>
+                        <Import-Package>
+                            ${javax.annotation.osgi.version},
+                            ${cdi.osgi.version},
+                            *
+                        </Import-Package>
                     </instructions>
                 </configuration>
             </plugin>
diff --git a/ext/cdi/jersey-cdi1x/pom.xml b/ext/cdi/jersey-cdi1x/pom.xml
index 98f00bb..dfe9675 100644
--- a/ext/cdi/jersey-cdi1x/pom.xml
+++ b/ext/cdi/jersey-cdi1x/pom.xml
@@ -87,6 +87,7 @@
                         <Import-Package>
                             ${javax.annotation.osgi.version},
                             ${hk2.osgi.version},
+                            ${cdi.osgi.version},
                             *
                         </Import-Package>
                     </instructions>
diff --git a/ext/microprofile/mp-rest-client/pom.xml b/ext/microprofile/mp-rest-client/pom.xml
index 2261e3a..62001d9 100644
--- a/ext/microprofile/mp-rest-client/pom.xml
+++ b/ext/microprofile/mp-rest-client/pom.xml
@@ -114,6 +114,8 @@
                             org.glassfish.jersey.restclient.*;version=${project.version}
                         </Export-Package>
                         <Import-Package>
+                            ${cdi.osgi.version},
+                            org.eclipse.microprofile.rest.client.*;version="[1,3)",
                             *
                         </Import-Package>
                     </instructions>
diff --git a/incubator/cdi-inject-weld/pom.xml b/incubator/cdi-inject-weld/pom.xml
index 60722a5..2eb3cf7 100644
--- a/incubator/cdi-inject-weld/pom.xml
+++ b/incubator/cdi-inject-weld/pom.xml
@@ -123,7 +123,8 @@
                         </Export-Package>
                         <Import-Package>
                             sun.misc.*;resolution:=optional,
-                            ${jakarta.annotation.osgi.version},
+                            ${cdi.osgi.version},
+                            ${javax.annotation.osgi.version},
                             *
                         </Import-Package>
                     </instructions>
diff --git a/inject/cdi2-se/pom.xml b/inject/cdi2-se/pom.xml
index ce8bf78..060d0c2 100644
--- a/inject/cdi2-se/pom.xml
+++ b/inject/cdi2-se/pom.xml
@@ -87,6 +87,7 @@
                         </Export-Package>
                         <Import-Package>
                             sun.misc.*;resolution:=optional,
+                            ${cdi.osgi.version},
                             ${javax.annotation.osgi.version},
                             *
                         </Import-Package>
diff --git a/pom.xml b/pom.xml
index dbc23b8..71b3103 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2207,6 +2207,7 @@
         <!-- do not need CQs -->
         <cdi.api.version>1.2</cdi.api.version>
         <cdi2.api.version>2.0.2</cdi2.api.version>
+        <cdi.osgi.version>javax.enterprise.*;version="[1,3)"</cdi.osgi.version>
         <ejb.version>3.2.6</ejb.version>
         <gf.impl.version>5.1.0</gf.impl.version>
         <grizzly.client.version>1.16</grizzly.client.version>
diff --git a/tests/integration/cdi-integration/gf-cdi-inject/arquillian.xml b/tests/integration/cdi-integration/gf-cdi-inject/arquillian.xml
new file mode 100644
index 0000000..edfddfb
--- /dev/null
+++ b/tests/integration/cdi-integration/gf-cdi-inject/arquillian.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!--
+
+    Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0, which is available at
+    http://www.eclipse.org/legal/epl-2.0.
+
+    This Source Code may also be made available under the following Secondary
+    Licenses when the conditions for such availability set forth in the
+    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+    version 2 with the GNU Classpath Exception, which is available at
+    https://www.gnu.org/software/classpath/license.html.
+
+    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xmlns="http://jboss.org/schema/arquillian"
+            xsi:schemaLocation="http://jboss.org/schema/arquillian
+    http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
+
+    <container qualifier="glassfish" default="true">
+        <configuration>
+            <property name="debug">true</property>
+        </configuration>
+    </container>
+
+</arquillian>
\ No newline at end of file
diff --git a/tests/integration/cdi-integration/gf-cdi-inject/pom.xml b/tests/integration/cdi-integration/gf-cdi-inject/pom.xml
new file mode 100644
index 0000000..c9bb428
--- /dev/null
+++ b/tests/integration/cdi-integration/gf-cdi-inject/pom.xml
@@ -0,0 +1,375 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0, which is available at
+    http://www.eclipse.org/legal/epl-2.0.
+
+    This Source Code may also be made available under the following Secondary
+    Licenses when the conditions for such availability set forth in the
+    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+    version 2 with the GNU Classpath Exception, which is available at
+    https://www.gnu.org/software/classpath/license.html.
+
+    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.glassfish.jersey.tests.integration.cdi</groupId>
+        <artifactId>cdi-integration-project</artifactId>
+        <version>2.37-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>gf-cdi-inject-on-server</artifactId>
+    <name>jersey-tests-glassfish-inject-on-server</name>
+
+    <description>Embedded GF tests @Inject</description>
+
+    <properties>
+        <glassfish.home>${project.build.directory}/payara5</glassfish.home>
+        <modules.dir>${glassfish.home}/glassfish/modules</modules.dir>
+        <glassfish.container.version>${gf.impl.version}</glassfish.container.version>
+        <junit.jupiter.version>5.7.2</junit.jupiter.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter</artifactId>
+            <version>${junit.jupiter.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+<!--        <dependency> This does not work with GF 5.1 -->
+<!--            <groupId>org.jboss.arquillian.container</groupId>-->
+<!--            <artifactId>arquillian-glassfish-managed-3.1</artifactId>-->
+<!--            <version>1.0.2</version>-->
+<!--        </dependency>-->
+
+        <dependency>
+            <groupId>org.omnifaces.arquillian</groupId>
+            <artifactId>arquillian-glassfish-server-managed</artifactId>
+            <version>1.2</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>jakarta.ws.rs</groupId>
+            <artifactId>jakarta.ws.rs-api</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.hamcrest</groupId>
+            <artifactId>hamcrest</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.glassfish.main.common</groupId>
+            <artifactId>simple-glassfish-api</artifactId>
+            <version>${glassfish.container.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.jboss.arquillian.junit5</groupId>
+            <artifactId>arquillian-junit5-container</artifactId>
+            <version>1.7.0.Alpha10</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.glassfish.jersey.core</groupId>
+            <artifactId>jersey-server</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>unpack</id>
+                        <phase>process-test-classes</phase>
+                        <goals>
+                            <goal>unpack</goal>
+                        </goals>
+                        <configuration>
+                            <artifactItems>
+                                <artifactItem>
+<!--                                    <groupId>org.glassfish.main.distributions</groupId>-->
+<!--                                    <artifactId>glassfish</artifactId>-->
+                                    <groupId>fish.payara.distributions</groupId>
+                                    <artifactId>payara</artifactId>
+                                    <version>5.2022.2</version>
+                                    <type>zip</type>
+                                    <overWrite>false</overWrite>
+                                    <outputDirectory>${project.build.directory}</outputDirectory>
+                                </artifactItem>
+                            </artifactItems>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>copy</id>
+                        <phase>process-test-classes</phase>
+                        <goals>
+                            <goal>copy</goal>
+                        </goals>
+                        <configuration>
+                            <artifactItems>
+                                <artifactItem>
+                                    <groupId>org.glassfish.jersey.ext</groupId>
+                                    <artifactId>jersey-bean-validation</artifactId>
+                                    <version>${jersey.version}</version>
+                                    <type>jar</type>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>${glassfish.home}/glassfish/modules</outputDirectory>
+                                    <destFileName>jersey-bean-validation.jar</destFileName>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.glassfish.jersey.ext.cdi</groupId>
+                                    <artifactId>jersey-cdi1x</artifactId>
+                                    <version>${jersey.version}</version>
+                                    <type>jar</type>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>${glassfish.home}/glassfish/modules</outputDirectory>
+                                    <destFileName>jersey-cdi1x.jar</destFileName>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.glassfish.jersey.ext.cdi</groupId>
+                                    <artifactId>jersey-cdi1x-servlet</artifactId>
+                                    <version>${jersey.version}</version>
+                                    <type>jar</type>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>${glassfish.home}/glassfish/modules</outputDirectory>
+                                    <destFileName>jersey-cdi1x-servlet.jar</destFileName>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.glassfish.jersey.ext.cdi</groupId>
+                                    <artifactId>jersey-cdi1x-transaction</artifactId>
+                                    <version>${jersey.version}</version>
+                                    <type>jar</type>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>${glassfish.home}/glassfish/modules</outputDirectory>
+                                    <destFileName>jersey-cdi1x-transaction.jar</destFileName>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.glassfish.jersey.ext.cdi</groupId>
+                                    <artifactId>jersey-cdi-rs-inject</artifactId>
+                                    <version>${jersey.version}</version>
+                                    <type>jar</type>
+                                    <outputDirectory>${glassfish.home}/glassfish/modules</outputDirectory>
+                                    <destFileName>jersey-cdi-rs-inject.jar</destFileName>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.glassfish.jersey.core</groupId>
+                                    <artifactId>jersey-client</artifactId>
+                                    <version>${jersey.version}</version>
+                                    <type>jar</type>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>${glassfish.home}/glassfish/modules</outputDirectory>
+                                    <destFileName>jersey-client.jar</destFileName>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.glassfish.jersey.core</groupId>
+                                    <artifactId>jersey-common</artifactId>
+                                    <version>${jersey.version}</version>
+                                    <type>jar</type>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>${glassfish.home}/glassfish/modules</outputDirectory>
+                                    <destFileName>jersey-common.jar</destFileName>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.glassfish.jersey.containers</groupId>
+                                    <artifactId>jersey-container-grizzly2-http</artifactId>
+                                    <version>${jersey.version}</version>
+                                    <type>jar</type>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>${glassfish.home}/glassfish/modules</outputDirectory>
+                                    <destFileName>jersey-container-grizzly2-http.jar</destFileName>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.glassfish.jersey.containers</groupId>
+                                    <artifactId>jersey-container-servlet</artifactId>
+                                    <version>${jersey.version}</version>
+                                    <type>jar</type>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>${glassfish.home}/glassfish/modules</outputDirectory>
+                                    <destFileName>jersey-container-servlet.jar</destFileName>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.glassfish.jersey.containers</groupId>
+                                    <artifactId>jersey-container-servlet-core</artifactId>
+                                    <version>${jersey.version}</version>
+                                    <type>jar</type>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>${glassfish.home}/glassfish/modules</outputDirectory>
+                                    <destFileName>jersey-container-servlet-core.jar</destFileName>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.glassfish.jersey.ext</groupId>
+                                    <artifactId>jersey-entity-filtering</artifactId>
+                                    <version>${jersey.version}</version>
+                                    <type>jar</type>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>${glassfish.home}/glassfish/modules</outputDirectory>
+                                    <destFileName>jersey-entity-filtering.jar</destFileName>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.glassfish.jersey.containers.glassfish</groupId>
+                                    <artifactId>jersey-gf-ejb</artifactId>
+                                    <version>${jersey.version}</version>
+                                    <type>jar</type>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>${glassfish.home}/glassfish/modules</outputDirectory>
+                                    <destFileName>jersey-gf-ejb.jar</destFileName>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.glassfish.jersey.inject</groupId>
+                                    <artifactId>jersey-hk2</artifactId>
+                                    <version>${jersey.version}</version>
+                                    <type>jar</type>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>${glassfish.home}/glassfish/modules</outputDirectory>
+                                    <destFileName>jersey-hk2.jar</destFileName>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.glassfish.jersey.media</groupId>
+                                    <artifactId>jersey-media-jaxb</artifactId>
+                                    <version>${jersey.version}</version>
+                                    <type>jar</type>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>${glassfish.home}/glassfish/modules</outputDirectory>
+                                    <destFileName>jersey-media-jaxb.jar</destFileName>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.glassfish.jersey.media</groupId>
+                                    <artifactId>jersey-media-json-binding</artifactId>
+                                    <version>${jersey.version}</version>
+                                    <type>jar</type>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>${glassfish.home}/glassfish/modules</outputDirectory>
+                                    <destFileName>jersey-media-json-binding.jar</destFileName>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.glassfish.jersey.media</groupId>
+                                    <artifactId>jersey-media-json-jackson</artifactId>
+                                    <version>${jersey.version}</version>
+                                    <type>jar</type>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>${glassfish.home}/glassfish/modules</outputDirectory>
+                                    <destFileName>jersey-media-json-jackson.jar</destFileName>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.glassfish.jersey.media</groupId>
+                                    <artifactId>jersey-media-json-processing</artifactId>
+                                    <version>${jersey.version}</version>
+                                    <type>jar</type>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>${glassfish.home}/glassfish/modules</outputDirectory>
+                                    <destFileName>jersey-media-json-processing.jar</destFileName>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.glassfish.jersey.media</groupId>
+                                    <artifactId>jersey-media-multipart</artifactId>
+                                    <version>${jersey.version}</version>
+                                    <type>jar</type>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>${glassfish.home}/glassfish/modules</outputDirectory>
+                                    <destFileName>jersey-media-multipart.jar</destFileName>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.glassfish.jersey.media</groupId>
+                                    <artifactId>jersey-media-sse</artifactId>
+                                    <version>${jersey.version}</version>
+                                    <type>jar</type>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>${glassfish.home}/glassfish/modules</outputDirectory>
+                                    <destFileName>jersey-media-sse.jar</destFileName>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.glassfish.jersey.ext.microprofile</groupId>
+                                    <artifactId>jersey-mp-rest-client</artifactId>
+                                    <version>${jersey.version}</version>
+                                    <type>jar</type>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>${glassfish.home}/glassfish/modules</outputDirectory>
+                                    <destFileName>jersey-mp-rest-client.jar</destFileName>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.glassfish.jersey.ext</groupId>
+                                    <artifactId>jersey-mvc</artifactId>
+                                    <version>${jersey.version}</version>
+                                    <type>jar</type>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>${glassfish.home}/glassfish/modules</outputDirectory>
+                                    <destFileName>jersey-mvc.jar</destFileName>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.glassfish.jersey.ext</groupId>
+                                    <artifactId>jersey-mvc-jsp</artifactId>
+                                    <version>${jersey.version}</version>
+                                    <type>jar</type>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>${glassfish.home}/glassfish/modules</outputDirectory>
+                                    <destFileName>jersey-mvc-jsp.jar</destFileName>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.glassfish.jersey.ext</groupId>
+                                    <artifactId>jersey-proxy-client</artifactId>
+                                    <version>${jersey.version}</version>
+                                    <type>jar</type>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>${glassfish.home}/glassfish/modules</outputDirectory>
+                                    <destFileName>jersey-proxy-client.jar</destFileName>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.glassfish.jersey.core</groupId>
+                                    <artifactId>jersey-server</artifactId>
+                                    <version>${jersey.version}</version>
+                                    <type>jar</type>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>${glassfish.home}/glassfish/modules</outputDirectory>
+                                    <destFileName>jersey-server.jar</destFileName>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>jakarta.ws.rs</groupId>
+                                    <artifactId>jakarta.ws.rs-api</artifactId>
+                                    <type>jar</type>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>${glassfish.home}/glassfish/modules</outputDirectory>
+                                    <destFileName>jakarta.ws.rs-api.jar</destFileName>
+                                </artifactItem>
+                            </artifactItems>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <includes>
+                        <include>**/GFTest.java</include>
+                    </includes>
+                    <dependenciesToScan>org.glassfish.jersey.tests.integration.cdi:gf-cdi-inject-on-server</dependenciesToScan>
+                    <systemPropertyVariables>
+                        <glassfish.home>${glassfish.home}</glassfish.home>
+                        <webServerPort>8080</webServerPort>
+                        <junit.log.traceflag>true</junit.log.traceflag>
+                    </systemPropertyVariables>
+                    <environmentVariables>
+                        <GLASSFISH_HOME>${glassfish.home}</GLASSFISH_HOME>
+                    </environmentVariables>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file
diff --git a/tests/integration/cdi-integration/gf-cdi-inject/src/main/java/org/glassfish/jersey/tests/cdi/gf/GFTestApp.java b/tests/integration/cdi-integration/gf-cdi-inject/src/main/java/org/glassfish/jersey/tests/cdi/gf/GFTestApp.java
new file mode 100644
index 0000000..0d77c95
--- /dev/null
+++ b/tests/integration/cdi-integration/gf-cdi-inject/src/main/java/org/glassfish/jersey/tests/cdi/gf/GFTestApp.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.jersey.tests.cdi.gf;
+
+import org.glassfish.jersey.server.ResourceConfig;
+
+import javax.ws.rs.ApplicationPath;
+
+@ApplicationPath("/test")
+public class GFTestApp extends ResourceConfig {
+    public GFTestApp() {
+        super(GFTestResource.class);
+    }
+}
diff --git a/tests/integration/cdi-integration/gf-cdi-inject/src/main/java/org/glassfish/jersey/tests/cdi/gf/GFTestResource.java b/tests/integration/cdi-integration/gf-cdi-inject/src/main/java/org/glassfish/jersey/tests/cdi/gf/GFTestResource.java
new file mode 100644
index 0000000..8e39cc8
--- /dev/null
+++ b/tests/integration/cdi-integration/gf-cdi-inject/src/main/java/org/glassfish/jersey/tests/cdi/gf/GFTestResource.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.jersey.tests.cdi.gf;
+
+import javax.inject.Inject;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriInfo;
+
+@Path("/")
+public class GFTestResource {
+    @Inject
+    UriInfo uriInfo;
+
+    @GET
+    @Path("info")
+    @Produces(MediaType.TEXT_PLAIN)
+    public String info() {
+        return uriInfo.getBaseUri().toASCIIString();
+    }
+}
diff --git a/tests/integration/cdi-integration/gf-cdi-inject/src/test/java/org/glassfish/jersey/tests/cdi/gf/GFTest.java b/tests/integration/cdi-integration/gf-cdi-inject/src/test/java/org/glassfish/jersey/tests/cdi/gf/GFTest.java
new file mode 100644
index 0000000..da49a8b
--- /dev/null
+++ b/tests/integration/cdi-integration/gf-cdi-inject/src/test/java/org/glassfish/jersey/tests/cdi/gf/GFTest.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.jersey.tests.cdi.gf;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit5.ArquillianExtension;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.core.Response;
+import java.io.IOException;
+
+@ExtendWith(ArquillianExtension.class)
+public class GFTest {
+    @Deployment(testable = false)
+    public static WebArchive createDeployment() throws IOException {
+        return createDeployment(
+                "gf-test",
+                GFTestApp.class,
+                GFTestResource.class
+        );
+    }
+
+    private static WebArchive createDeployment(String archiveName, Class<?>...classes) {
+        WebArchive archive = ShrinkWrap.create(WebArchive.class, archiveName + ".war");
+        archive.addClasses(classes);
+        return archive;
+    }
+
+    @Test
+    public void testUriInfo() {
+        int port = Integer.parseInt(System.getProperty("webServerPort"));
+        try (Response response = ClientBuilder.newClient().target("http://localhost:" + port).path("gf-test/test/info").request().get()) {
+            String entity = response.readEntity(String.class);
+            System.out.println(entity);
+            Assertions.assertEquals(200, response.getStatus());
+            Assertions.assertTrue(entity.contains("gf-test/test"));
+        }
+    }
+}
diff --git a/tests/integration/cdi-integration/pom.xml b/tests/integration/cdi-integration/pom.xml
index b164acb..36b5a6a 100644
--- a/tests/integration/cdi-integration/pom.xml
+++ b/tests/integration/cdi-integration/pom.xml
@@ -61,4 +61,15 @@
             </plugin>
         </plugins>
     </build>
+    <profiles>
+        <profile>
+            <id>gf-inject</id>
+            <activation>
+                <jdk>[11,16)</jdk>
+            </activation>
+            <modules>
+                <module>gf-cdi-inject</module>
+            </modules>
+        </profile>
+    </profiles>
 </project>