NIFI-10211 Add dependencies for running minifi on java11

Signed-off-by: Matthew Burgess <mattyb149@apache.org>

This closes #6191
This commit is contained in:
Ferenc Erdei 2022-07-11 11:19:49 +02:00 committed by Matthew Burgess
parent a9b5bebb15
commit f05d0f10f3
No known key found for this signature in database
GPG Key ID: 05D3DEB8126DAD24
8 changed files with 131 additions and 5 deletions

View File

@ -521,3 +521,28 @@ style license.
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
The binary distribution of this product bundles 'Jakarta Activation', 'Jakarta Activation API' and 'Jakarta XML Binding API 2.3.3' modules under an EDL v1.0 license
Copyright (c) 2007, Eclipse Foundation, Inc. and its licensors.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the distribution.
Neither the name of the Eclipse Foundation, Inc. nor the names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

View File

@ -640,7 +640,7 @@ The following binary components are provided under the Common Development and Di
(CDDL 1.1) (GPL2 w/ CPE) JSON Processing API (javax.json:javax.json-api:jar:1.0 - https://json-processing-spec.java.net)
(CDDL 1.1) (GPL2 w/ CPE) JSON Processing Default Provider (org.glassfish:javax.json:jar:1.0.4 - https://jsonp.java.net)
(CDDL 1.1) (GPL2 w/ CPE) OSGi resource locator bundle (org.glassfish.hk2:osgi-resource-locator:jar:1.0.1 - https://glassfish.org/osgi-resource-locator)
(CDDL 1.1) (GPL2 w/ CPE) javax.annotation API (javax.annotation:javax.annotation-api:jar:1.2 - https://jcp.org/en/jsr/detail?id=250)
(CDDL 1.1) (GPL2 w/ CPE) javax.annotation API (javax.annotation:javax.annotation-api:jar:1.3.2 - https://jcp.org/en/jsr/detail?id=250)
(CDDL 1.1) (GPL2 w/ CPE) javax.inject:1 as OSGi bundle (org.glassfish.hk2.external:javax.inject:jar:2.4.0-b25 - https://hk2.java.net/external/javax.inject)
(CDDL 1.1) (GPL2 w/ CPE) javax.ws.rs-api (javax.ws.rs:javax.ws.rs-api:jar:2.1 - https://jax-rs-spec.java.net)
@ -664,6 +664,19 @@ The following binary components are provided under the Eclipse Public License 1.
(EPL 1.0)(LGPL 2.1) Logback Classic (ch.qos.logback:logback-classic:jar:1.2.6 - https://logback.qos.ch/)
(EPL 1.0)(LGPL 2.1) Logback Core (ch.qos.logback:logback-core:jar:1.2.6 - https://logback.qos.ch/)
************************
Eclipse Distribution License 1.0
************************
The following binary components are provided under the Eclipse Distribution License 1.0.
(EDL 1.0) Jakarta Activation API (jakarta.activation:jakarta.activation-api:jar:1.2.2)
(EDL 1.0) Jakarta Activation (com.sun.activation:jakarta.activation:jar:1.2.2)
(EDL 1.0) Jakarta XML Binding API (jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.3)
(EDL 1.0) JAXB (JSR 222) Reference Implementation (org.glassfish.jaxb:jaxb-runtime:jar:2.3.5)
(EDL 1.0) Istack Common Utility Code Runtime (com.sun.istack:istack-commons-runtime:jar:3.0.12)
(EDL 1.0) TXW2 Runtime (org.glassfish.jaxb:txw2:jar:2.3.5)
*****************
Mozilla Public License v2.0
*****************

View File

@ -221,6 +221,24 @@ limitations under the License.
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<!-- dependencies for jaxb/activation/annotation for running MiNiFi on Java 11 -->
<!-- TODO: remove these once minimum Java version is 11 -->
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>${jakarta.xml.bind-api.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>${jaxb.runtime.version}</version>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>${javax.annotation-api.version}</version>
</dependency>
</dependencies>
<properties>

View File

@ -43,13 +43,18 @@
<exclude>swagger-annotations</exclude>
<exclude>aspectjweaver</exclude>
<exclude>h2</exclude>
<exclude>jaxb-runtime</exclude>
<exclude>mail</exclude>
<exclude>log4j</exclude>
<exclude>lucene-queryparser</exclude>
<exclude>commons-net</exclude>
<exclude>spring-context</exclude>
<exclude>spring-security-core</exclude>
<!-- exclude jaxb/activation/annotation libs from lib, they'll be included in the java11 subdir -->
<!-- TODO: remove these once minimum Java version is 11 -->
<exclude>org.glassfish.jaxb:jaxb-runtime</exclude>
<exclude>jakarta.xml.bind:jakarta.xml.bind-api</exclude>
<exclude>javax.annotation:javax.annotation-api</exclude>
</excludes>
</dependencySet>
@ -72,6 +77,24 @@
</includes>
</dependencySet>
<!-- Write out the bootstrap libs for java11 to its own dir -->
<!-- TODO: remove this dependency set once minimum Java version is 11 -->
<dependencySet>
<scope>runtime</scope>
<useProjectArtifact>false</useProjectArtifact>
<outputDirectory>lib/java11</outputDirectory>
<directoryMode>0770</directoryMode>
<fileMode>0664</fileMode>
<useTransitiveFiltering>true</useTransitiveFiltering>
<includes>
<include>org.glassfish.jaxb:jaxb-runtime</include>
<include>jakarta.xml.bind:jakarta.xml.bind-api</include>
<include>javax.annotation:javax.annotation-api</include>
<include>com.sun.activation:jakarta.activation</include>
<include>jakarta.activation:jakarta.activation-api</include>
</includes>
</dependencySet>
<!-- Write out the conf directory contents -->
<dependencySet>
<scope>runtime</scope>

View File

@ -43,13 +43,18 @@
<exclude>swagger-annotations</exclude>
<exclude>aspectjweaver</exclude>
<exclude>h2</exclude>
<exclude>jaxb-runtime</exclude>
<exclude>mail</exclude>
<exclude>log4j</exclude>
<exclude>lucene-queryparser</exclude>
<exclude>commons-net</exclude>
<exclude>spring-context</exclude>
<exclude>spring-security-core</exclude>
<!-- exclude jaxb/activation/annotation libs from lib, they'll be included in the java11 subdir -->
<!-- TODO: remove these once minimum Java version is 11 -->
<exclude>org.glassfish.jaxb:jaxb-runtime</exclude>
<exclude>jakarta.xml.bind:jakarta.xml.bind-api</exclude>
<exclude>javax.annotation:javax.annotation-api</exclude>
</excludes>
</dependencySet>
@ -73,6 +78,24 @@
</includes>
</dependencySet>
<!-- Write out the bootstrap libs for java11 to its own dir -->
<!-- TODO: remove this dependency set once minimum Java version is 11 -->
<dependencySet>
<scope>runtime</scope>
<useProjectArtifact>false</useProjectArtifact>
<outputDirectory>lib/java11</outputDirectory>
<directoryMode>0770</directoryMode>
<fileMode>0664</fileMode>
<useTransitiveFiltering>true</useTransitiveFiltering>
<includes>
<include>org.glassfish.jaxb:jaxb-runtime</include>
<include>jakarta.xml.bind:jakarta.xml.bind-api</include>
<include>javax.annotation:javax.annotation-api</include>
<include>com.sun.activation:jakarta.activation</include>
<include>jakarta.activation:jakarta.activation-api</include>
</includes>
</dependencySet>
<!-- Write out the conf directory contents -->
<dependencySet>
<scope>runtime</scope>

View File

@ -18,6 +18,7 @@
package org.apache.nifi.minifi.bootstrap.service;
import static org.apache.nifi.minifi.bootstrap.RunMiNiFi.CONF_DIR_KEY;
import static org.apache.nifi.minifi.bootstrap.RunMiNiFi.DEFAULT_LOGGER;
import java.io.File;
import java.io.IOException;
@ -26,6 +27,7 @@ import java.util.List;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.Properties;
import org.apache.nifi.bootstrap.util.OSUtils;
public class MiNiFiExecCommandProvider {
@ -109,6 +111,7 @@ public class MiNiFiExecCommandProvider {
for (File file : libFiles) {
cpFiles.add(file.getAbsolutePath());
}
cpFiles.addAll(getJava11Files(libDir));
StringBuilder classPathBuilder = new StringBuilder();
for (int i = 0; i < cpFiles.size(); i++) {
@ -122,6 +125,26 @@ public class MiNiFiExecCommandProvider {
return classPathBuilder.toString();
}
private List<String> getJava11Files(File libDir) {
List<String> java11Files = new ArrayList();
String runtimeJavaVersion = System.getProperty("java.version");
DEFAULT_LOGGER.info("Runtime Java version: {}", runtimeJavaVersion);
if (OSUtils.parseJavaVersion(runtimeJavaVersion) >= 11) {
/* If running on Java 11 or greater, add the JAXB/activation/annotation libs to the classpath.
*
* TODO: Once the minimum Java version requirement of NiFi is 11, this processing should be removed.
* JAXB/activation/annotation will be added as an actual dependency via pom.xml.
*/
File libJava11Dir = getFile("java11", libDir);
if (libJava11Dir.exists()) {
for (File file : libJava11Dir.listFiles((dir, filename) -> filename.toLowerCase().endsWith(".jar"))) {
java11Files.add(file.getAbsolutePath());
}
}
}
return java11Files;
}
private List<String> getJavaAdditionalArgs(Properties props) {
List<String> javaAdditionalArgs = new ArrayList<>();
for (Entry<Object, Object> entry : props.entrySet()) {

View File

@ -847,7 +847,7 @@ language governing permissions and limitations under the License. -->
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
<version>${javax.annotation-api.version}</version>
</dependency>
<!-- AspectJ library needed by the Java Agent used for native library loading (see bootstrap.conf) -->
<dependency>

View File

@ -118,6 +118,7 @@
<jackson.bom.version>2.13.3</jackson.bom.version>
<avro.version>1.11.0</avro.version>
<jaxb.runtime.version>2.3.5</jaxb.runtime.version>
<javax.annotation-api.version>1.3.2</javax.annotation-api.version>
<jakarta.xml.bind-api.version>2.3.3</jakarta.xml.bind-api.version>
<json.smart.version>2.4.8</json.smart.version>
<nifi.groovy.version>3.0.9</nifi.groovy.version>