Skip to content

Commit

Permalink
Put module-info.class into Multi-Release JAR folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcono1234 committed Nov 6, 2021
1 parent a92bbf8 commit 9a4c0b1
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 20 deletions.
6 changes: 6 additions & 0 deletions gson/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,9 @@ Import-Package: sun.misc;resolution:=optional, *
com.google.gson.annotations,\
com.google.gson.reflect,\
com.google.gson.stream

# Ignore error about module-info.class being in wrong directory
# See related https://issues.apache.org/jira/browse/FELIX-5592 (but that is for different plugin)
# and https://github.com/bndtools/bnd/issues/2227
-fixupmessages:\
"Classes found in the wrong directory: \\{META-INF/versions/9/module-info\\.class=module-info\\}";is:=warning
1 change: 1 addition & 0 deletions gson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<!-- Use existing manifest generated by BND plugin -->
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
Expand Down
45 changes: 25 additions & 20 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.6</java.version>
<javaVersion>1.6</javaVersion>
</properties>

<scm>
Expand Down Expand Up @@ -70,30 +70,32 @@
<id>default-compile</id>
<configuration>
<jdkToolchain>
<version>9</version>
<version>[1.5,9)</version>
</jdkToolchain>
<release>9</release>
<source>${javaVersion}</source>
<target>${javaVersion}</target>
<excludes>
<exclude>module-info.java</exclude>
</excludes>
</configuration>
</execution>
<execution>
<id>base-compile</id>
<id>java-9-compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<excludes>
<exclude>module-info.java</exclude>
</excludes>
<jdkToolchain>
<version>9</version>
</jdkToolchain>
<release>9</release>
<includes>
<include>module-info.java</include>
</includes>
<multiReleaseOutput>true</multiReleaseOutput>
</configuration>
</execution>
</executions>
<configuration>
<jdkToolchain>
<version>[1.5,9)</version>
</jdkToolchain>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -104,12 +106,15 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>5.1.2</version>
<inherited>true</inherited>
<configuration>
<archive>
<manifestEntries>
<!-- Mark the JAR as Multi-Release JAR because module-info.class
is in version specific folder -->
<Multi-Release>true</Multi-Release>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</pluginManagement>
Expand Down

0 comments on commit 9a4c0b1

Please sign in to comment.