Skip to content

Commit

Permalink
Create manifest files separately and reference in bundle plugin, THEN…
Browse files Browse the repository at this point in the history
… shade in the new manifest for Jakarta separately before install (#136)

* Transform Service Loaders, and Manifests for Jakarta Artifacts

* Create manifest files separately and reference in bundle plugin, THEN shade in the new manifest for jakarta separately before install

#132
  • Loading branch information
GedMarc authored Feb 23, 2021
1 parent 170304f commit b30d5a9
Show file tree
Hide file tree
Showing 5 changed files with 214 additions and 35 deletions.
57 changes: 53 additions & 4 deletions base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ ${project.groupId}.annotation.*;version=${project.version}
<plugin>
<groupId>org.moditect</groupId>
<artifactId>moditect-maven-plugin</artifactId>
<configuration>
<jvmVersion>11</jvmVersion>
</configuration>
</plugin>

<plugin>
Expand All @@ -71,6 +74,14 @@ ${project.groupId}.annotation.*;version=${project.version}
<include>${project.groupId}:${project.artifactId}</include>
</includes>
</artifactSet>
<filters>
<filter>
<artifact>${project.groupId}:${project.artifactId}</artifact>
<excludes>
<exclude>META-INF/MANIFEST.MF</exclude>
</excludes>
</filter>
</filters>
<relocations>
<relocation>
<pattern>javax.xml.bind</pattern>
Expand All @@ -91,10 +102,9 @@ ${project.groupId}.annotation.*;version=${project.version}
</relocations>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="io.yupiik.maven.shade.transformer.RelocationTransformer">
<delegates>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"/>
</delegates>
<transformer implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
<resource>META-INF/MANIFEST.MF</resource>
<file>${build.directory}/jakarta/MANIFEST.MF</file>
</transformer>
</transformers>
</configuration>
Expand All @@ -109,6 +119,45 @@ ${project.groupId}.annotation.*;version=${project.version}
</dependencies>
</plugin>

<!-- Jakarta bundle fix - nb place last for execution order on package phase
@gedmarc 20210222-->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>5.1.1</version>
<executions>
<execution>
<id>default_bundle</id>
<phase>process-classes</phase>
<goals>
<goal>bundle</goal>
</goals>
<configuration>
<manifestLocation>${build.directory}/javax</manifestLocation>
<packaging>jar</packaging>
<instructions>
<_nouses>false</_nouses>
</instructions>
</configuration>
</execution>
<execution>
<id>bundle_jakarta_manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
<configuration>
<manifestLocation>${build.directory}/jakarta</manifestLocation>
<classifier>jakarta</classifier>
<packaging>jar</packaging>
<instructions>
<Import-Package>jakarta.ws.rs;version="[3.0,4)",jakarta.ws.rs.core;version="[3.0,4)",jakarta.ws.rs.ext;version="[3.0,4)",!javax.ws*,*</Import-Package>
</instructions>
</configuration>
</execution>
</executions>
</plugin>

</plugins>
</build>
</project>
57 changes: 53 additions & 4 deletions datatypes/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@
<plugin>
<groupId>org.moditect</groupId>
<artifactId>moditect-maven-plugin</artifactId>
<configuration>
<jvmVersion>11</jvmVersion>
</configuration>
</plugin>

<plugin>
Expand All @@ -96,6 +99,14 @@
<include>${project.groupId}:${project.artifactId}</include>
</includes>
</artifactSet>
<filters>
<filter>
<artifact>${project.groupId}:${project.artifactId}</artifact>
<excludes>
<exclude>META-INF/MANIFEST.MF</exclude>
</excludes>
</filter>
</filters>
<relocations>
<relocation>
<pattern>javax.xml.bind</pattern>
Expand All @@ -116,10 +127,9 @@
</relocations>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="io.yupiik.maven.shade.transformer.RelocationTransformer">
<delegates>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"/>
</delegates>
<transformer implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
<resource>META-INF/MANIFEST.MF</resource>
<file>${build.directory}/jakarta/MANIFEST.MF</file>
</transformer>
</transformers>
</configuration>
Expand All @@ -134,6 +144,45 @@
</dependencies>
</plugin>

<!-- Jakarta bundle fix - nb place last for execution order on package phase
@gedmarc 20210222-->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>5.1.1</version>
<executions>
<execution>
<id>default_bundle</id>
<phase>process-classes</phase>
<goals>
<goal>bundle</goal>
</goals>
<configuration>
<manifestLocation>${build.directory}/javax</manifestLocation>
<packaging>jar</packaging>
<instructions>
<_nouses>false</_nouses>
</instructions>
</configuration>
</execution>
<execution>
<id>bundle_jakarta_manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
<configuration>
<manifestLocation>${build.directory}/jakarta</manifestLocation>
<classifier>jakarta</classifier>
<packaging>jar</packaging>
<instructions>
<Import-Package>jakarta.ws.rs;version="[3.0,4)",jakarta.ws.rs.core;version="[3.0,4)",jakarta.ws.rs.ext;version="[3.0,4)",!javax.ws*,*</Import-Package>
</instructions>
</configuration>
</execution>
</executions>
</plugin>

</plugins>
</build>
</project>
57 changes: 53 additions & 4 deletions json/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@
<plugin>
<groupId>org.moditect</groupId>
<artifactId>moditect-maven-plugin</artifactId>
<configuration>
<jvmVersion>11</jvmVersion>
</configuration>
</plugin>

<plugin>
Expand All @@ -131,6 +134,14 @@
<include>${project.groupId}:${project.artifactId}</include>
</includes>
</artifactSet>
<filters>
<filter>
<artifact>${project.groupId}:${project.artifactId}</artifact>
<excludes>
<exclude>META-INF/MANIFEST.MF</exclude>
</excludes>
</filter>
</filters>
<relocations>
<relocation>
<pattern>javax.xml.bind</pattern>
Expand All @@ -151,10 +162,9 @@
</relocations>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="io.yupiik.maven.shade.transformer.RelocationTransformer">
<delegates>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"/>
</delegates>
<transformer implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
<resource>META-INF/MANIFEST.MF</resource>
<file>${build.directory}/jakarta/MANIFEST.MF</file>
</transformer>
</transformers>
</configuration>
Expand All @@ -168,6 +178,45 @@
</dependency>
</dependencies>
</plugin>

<!-- Jakarta bundle fix - nb place last for execution order on package phase
@gedmarc 20210222-->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>5.1.1</version>
<executions>
<execution>
<id>default_bundle</id>
<phase>process-classes</phase>
<goals>
<goal>bundle</goal>
</goals>
<configuration>
<manifestLocation>${build.directory}/javax</manifestLocation>
<packaging>jar</packaging>
<instructions>
<_nouses>false</_nouses>
</instructions>
</configuration>
</execution>
<execution>
<id>bundle_jakarta_manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
<configuration>
<manifestLocation>${build.directory}/jakarta</manifestLocation>
<classifier>jakarta</classifier>
<packaging>jar</packaging>
<instructions>
<Import-Package>jakarta.ws.rs;version="[3.0,4)",jakarta.ws.rs.core;version="[3.0,4)",jakarta.ws.rs.ext;version="[3.0,4)",!javax.ws*,*</Import-Package>
</instructions>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
24 changes: 5 additions & 19 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,14 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>5.1.1</version>
<configuration>
<instructions>
<_nouses>false</_nouses>
</instructions>
</configuration>
</plugin>

<plugin>
<!-- Inherited from oss-base. Generate PackageVersion.java.-->
<groupId>com.google.code.maven-replacer-plugin</groupId>
Expand All @@ -148,33 +150,17 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.moditect</groupId>
<artifactId>moditect-maven-plugin</artifactId>
<!-- 20-Feb-2021, tatu: For Jackson 2.x, put `module-info.class` under location
only visible to JDK 11+ (to avoid issues with older pre-Java9 frameworks?)
-->
<configuration>
<jvmVersion>11</jvmVersion>
</configuration>
</plugin>
<!-- 20-Feb-2021, tatu: As per [jaxrs-providers#132] need some more relocating... -->
<!-- TODO!!! Why is version number here not sufficient for child projects?! -->
<plugin>
<groupId>io.yupiik.maven</groupId>
<artifactId>maven-shade-transformers</artifactId>
<version>0.0.1</version>
</plugin>

</plugins>
</pluginManagement>

<!-- 05-Jul-2020, tatu: Add generation of Gradle Module Metadata -->
<plugins>
<plugin>

<plugin>
<groupId>de.jjohannes</groupId>
<artifactId>gradle-module-metadata-maven-plugin</artifactId>
</plugin>
</plugin>
</plugins>
</build>
</project>
54 changes: 50 additions & 4 deletions xml/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@
<include>${project.groupId}:${project.artifactId}</include>
</includes>
</artifactSet>
<filters>
<filter>
<artifact>${project.groupId}:${project.artifactId}</artifact>
<excludes>
<exclude>META-INF/MANIFEST.MF</exclude>
</excludes>
</filter>
</filters>
<relocations>
<relocation>
<pattern>javax.xml.bind</pattern>
Expand All @@ -153,10 +161,9 @@
</relocations>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="io.yupiik.maven.shade.transformer.RelocationTransformer">
<delegates>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"/>
</delegates>
<transformer implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
<resource>META-INF/MANIFEST.MF</resource>
<file>${build.directory}/jakarta/MANIFEST.MF</file>
</transformer>
</transformers>
</configuration>
Expand All @@ -170,6 +177,45 @@
</dependency>
</dependencies>
</plugin>

<!-- Jakarta bundle fix - nb place last for execution order on package phase
@gedmarc 20210222-->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>5.1.1</version>
<executions>
<execution>
<id>default_bundle</id>
<phase>process-classes</phase>
<goals>
<goal>bundle</goal>
</goals>
<configuration>
<manifestLocation>${build.directory}/javax</manifestLocation>
<packaging>jar</packaging>
<instructions>
<_nouses>false</_nouses>
</instructions>
</configuration>
</execution>
<execution>
<id>bundle_jakarta_manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
<configuration>
<manifestLocation>${build.directory}/jakarta</manifestLocation>
<classifier>jakarta</classifier>
<packaging>jar</packaging>
<instructions>
<Import-Package>jakarta.ws.rs;version="[3.0,4)",jakarta.ws.rs.core;version="[3.0,4)",jakarta.ws.rs.ext;version="[3.0,4)",!javax.ws*,*</Import-Package>
</instructions>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

0 comments on commit b30d5a9

Please sign in to comment.