Skip to content

Commit

Permalink
[FLINK-14905][build] Unify Java8/11 packaging process
Browse files Browse the repository at this point in the history
  • Loading branch information
zentol committed Nov 29, 2019
1 parent 3898a4b commit 4ba834d
Show file tree
Hide file tree
Showing 7 changed files with 253 additions and 103 deletions.
28 changes: 9 additions & 19 deletions flink-connectors/flink-connector-kinesis/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,15 @@ under the License.
</exclusions>
</dependency>

<dependency>
<!-- KPL requires jaxb-api for javax.xml.bind.DatatypeConverter -->
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>${jaxb.api.version}</version>
<!-- packaged in flink-dist -->
<scope>provided</scope>
</dependency>

</dependencies>

<dependencyManagement>
Expand Down Expand Up @@ -195,8 +204,6 @@ under the License.
<include>com.amazonaws:*</include>
<include>com.google.protobuf:*</include>
<include>org.apache.httpcomponents:*</include>
<!-- Java 11 specific inclusion; should be a no-op for other versions -->
<include>javax.xml.bind:jaxb-api</include>
</includes>
</artifactSet>
<relocations combine.children="override">
Expand All @@ -220,21 +227,4 @@ under the License.
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>java11</id>
<activation>
<jdk>11</jdk>
</activation>
<dependencies>
<dependency>
<!-- KPL requires jaxb-api for javax.xml.bind.DatatypeConverter -->
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
76 changes: 76 additions & 0 deletions flink-dist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,15 @@ under the License.
</dependency>
<!-- end optional Flink libraries -->

<dependency>
<!-- some components require jaxb-api on Java 11+, which is no longer bundled with the JDK -->
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<!-- packaged as an optional dependency that is only accessible on Java 11+ -->
<!-- this entry exists to prevent a compile dependency from slipping through -->
<scope>provided</scope>
</dependency>

<!-- test dependencies -->

<dependency>
Expand Down Expand Up @@ -546,6 +555,73 @@ under the License.
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<archive>
<manifestEntries>
<!-- jaxb-api is packaged as an optional dependency that is only accessible on Java 11 -->
<Multi-Release>true</Multi-Release>
</manifestEntries>
</archive>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-jaxb-jar</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
</execution>
</executions>
<configuration>
<artifactItems>
<artifactItem>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>${jaxb.api.version}</version>
<type>jar</type>
<overWrite>true</overWrite>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}/temporary</outputDirectory>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>unpack-jaxb-library</id>
<phase>process-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<echo message="unpacking jaxb-api jar"/>
<unzip src="${project.build.directory}/temporary/jaxb-api-${jaxb.api.version}.jar"
dest="${project.build.directory}/classes/META-INF/versions/11"/>
</target>
</configuration>
</execution>
</executions>
</plugin>

<!--Build uber jar-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
5 changes: 5 additions & 0 deletions flink-dist/src/main/resources/META-INF/NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ See bundled license files for details.
- com.github.scopt:scopt_2.11:3.5.0
- org.slf4j:slf4j-api:1.7.15

This project bundles the following dependencies under the CDDL 1.1 license.
See bundled license files for details.

- javax.xml.bind:jaxb-api:2.3.0

This project bundles "org.tukaani:xz:1.5".
This Java implementation of XZ has been put into the public domain, thus you can do
whatever you want with it. All the files in the package have been written by Lasse Collin,
Expand Down
Loading

0 comments on commit 4ba834d

Please sign in to comment.