This is an automated email from the ASF dual-hosted git repository.

mattyb149 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new f05d0f10f3 NIFI-10211 Add dependencies for running minifi on java11
f05d0f10f3 is described below

commit f05d0f10f364654acfffad647e81b885f24e8696
Author: Ferenc Erdei <[email protected]>
AuthorDate: Mon Jul 11 11:19:49 2022 +0200

    NIFI-10211 Add dependencies for running minifi on java11
    
    Signed-off-by: Matthew Burgess <[email protected]>
    
    This closes #6191
---
 minifi/minifi-assembly/LICENSE                     | 27 +++++++++++++++++++++-
 minifi/minifi-assembly/NOTICE                      | 15 +++++++++++-
 minifi/minifi-assembly/pom.xml                     | 18 +++++++++++++++
 .../main/assembly/dependencies-windows-service.xml | 25 +++++++++++++++++++-
 .../src/main/assembly/dependencies.xml             | 25 +++++++++++++++++++-
 .../service/MiNiFiExecCommandProvider.java         | 23 ++++++++++++++++++
 nifi-assembly/pom.xml                              |  2 +-
 pom.xml                                            |  1 +
 8 files changed, 131 insertions(+), 5 deletions(-)

diff --git a/minifi/minifi-assembly/LICENSE b/minifi/minifi-assembly/LICENSE
index af59c3fb40..8a95c73f6e 100644
--- a/minifi/minifi-assembly/LICENSE
+++ b/minifi/minifi-assembly/LICENSE
@@ -520,4 +520,29 @@ style license.
     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.
\ No newline at end of file
+    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.
\ No newline at end of file
diff --git a/minifi/minifi-assembly/NOTICE b/minifi/minifi-assembly/NOTICE
index 26aefd843c..c68aef12dd 100644
--- a/minifi/minifi-assembly/NOTICE
+++ b/minifi/minifi-assembly/NOTICE
@@ -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
 *****************
diff --git a/minifi/minifi-assembly/pom.xml b/minifi/minifi-assembly/pom.xml
index fb61fb16e2..ab654e67e3 100644
--- a/minifi/minifi-assembly/pom.xml
+++ b/minifi/minifi-assembly/pom.xml
@@ -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>
diff --git 
a/minifi/minifi-assembly/src/main/assembly/dependencies-windows-service.xml 
b/minifi/minifi-assembly/src/main/assembly/dependencies-windows-service.xml
index 506b734283..f8b6b8bfb6 100644
--- a/minifi/minifi-assembly/src/main/assembly/dependencies-windows-service.xml
+++ b/minifi/minifi-assembly/src/main/assembly/dependencies-windows-service.xml
@@ -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>
diff --git a/minifi/minifi-assembly/src/main/assembly/dependencies.xml 
b/minifi/minifi-assembly/src/main/assembly/dependencies.xml
index 99cbcdeb5a..5b2031be19 100644
--- a/minifi/minifi-assembly/src/main/assembly/dependencies.xml
+++ b/minifi/minifi-assembly/src/main/assembly/dependencies.xml
@@ -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>
diff --git 
a/minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/service/MiNiFiExecCommandProvider.java
 
b/minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/service/MiNiFiExecCommandProvider.java
index 596dbbafbd..dcf8641002 100644
--- 
a/minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/service/MiNiFiExecCommandProvider.java
+++ 
b/minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/service/MiNiFiExecCommandProvider.java
@@ -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()) {
diff --git a/nifi-assembly/pom.xml b/nifi-assembly/pom.xml
index 80a24b4d11..85601c9b63 100644
--- a/nifi-assembly/pom.xml
+++ b/nifi-assembly/pom.xml
@@ -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>
diff --git a/pom.xml b/pom.xml
index f4cea28a8f..60fe64602a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -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>

Reply via email to