Work-in-progress for profile for compiling on Java 9
for Java 1.8, default no-arg constructors have been added, and RunNiFi detects 
if --add-modules needs to be added to the java command depending on the java 
version


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/4aac5283
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/4aac5283
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/4aac5283

Branch: refs/heads/java-9-support
Commit: 4aac52839e03be0026dc6fe3d56138ea7b52cb85
Parents: 1c775bb
Author: Jeff Storck <jtsw...@gmail.com>
Authored: Fri May 11 17:31:25 2018 -0400
Committer: Jeff Storck <jtsw...@gmail.com>
Committed: Fri May 11 17:31:25 2018 -0400

----------------------------------------------------------------------
 .../java/org/apache/nifi/bootstrap/RunNiFi.java |  4 +
 .../authorization/FileAccessPolicyProvider.java |  3 +
 .../authorization/FileUserGroupProvider.java    |  6 +-
 pom.xml                                         | 98 ++++++++++++++++++--
 4 files changed, 99 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/4aac5283/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java
----------------------------------------------------------------------
diff --git 
a/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java 
b/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java
index 2a0e36e..953cdce 100644
--- a/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java
+++ b/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java
@@ -1032,6 +1032,10 @@ public class RunNiFi {
         cmd.add("-Dnifi.bootstrap.listen.port=" + listenPort);
         cmd.add("-Dapp=NiFi");
         cmd.add("-Dorg.apache.nifi.bootstrap.config.log.dir=" + nifiLogDir);
+        if (!System.getProperty("java.version").startsWith("1.")) {
+            // running on Java 9+, java.xml.bind module must be made available
+            cmd.add("--add-modules=java.xml.bind");
+        }
         cmd.add("org.apache.nifi.NiFi");
         if (isSensitiveKeyPresent(props)) {
             Path sensitiveKeyFile = createSensitiveKeyFile(confDir);

http://git-wip-us.apache.org/repos/asf/nifi/blob/4aac5283/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-file-authorizer/src/main/java/org/apache/nifi/authorization/FileAccessPolicyProvider.java
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-file-authorizer/src/main/java/org/apache/nifi/authorization/FileAccessPolicyProvider.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-file-authorizer/src/main/java/org/apache/nifi/authorization/FileAccessPolicyProvider.java
index 99f447f..0918dd9 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-file-authorizer/src/main/java/org/apache/nifi/authorization/FileAccessPolicyProvider.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-file-authorizer/src/main/java/org/apache/nifi/authorization/FileAccessPolicyProvider.java
@@ -137,6 +137,9 @@ public class FileAccessPolicyProvider implements 
ConfigurableAccessPolicyProvide
     private UserGroupProviderLookup userGroupProviderLookup;
     private final AtomicReference<AuthorizationsHolder> authorizationsHolder = 
new AtomicReference<>();
 
+    public FileAccessPolicyProvider() {
+    }
+
     @Override
     public void initialize(AccessPolicyProviderInitializationContext 
initializationContext) throws AuthorizerCreationException {
         userGroupProviderLookup = 
initializationContext.getUserGroupProviderLookup();

http://git-wip-us.apache.org/repos/asf/nifi/blob/4aac5283/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-file-authorizer/src/main/java/org/apache/nifi/authorization/FileUserGroupProvider.java
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-file-authorizer/src/main/java/org/apache/nifi/authorization/FileUserGroupProvider.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-file-authorizer/src/main/java/org/apache/nifi/authorization/FileUserGroupProvider.java
index 1335462..165c179 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-file-authorizer/src/main/java/org/apache/nifi/authorization/FileUserGroupProvider.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-file-authorizer/src/main/java/org/apache/nifi/authorization/FileUserGroupProvider.java
@@ -74,9 +74,6 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 public class FileUserGroupProvider implements ConfigurableUserGroupProvider {
-    public FileUserGroupProvider() {
-    }
-
     private static final Logger logger = 
LoggerFactory.getLogger(FileUserGroupProvider.class);
 
     private static final String TENANTS_XSD = "/tenants.xsd";
@@ -125,6 +122,9 @@ public class FileUserGroupProvider implements 
ConfigurableUserGroupProvider {
 
     private final AtomicReference<UserGroupHolder> userGroupHolder = new 
AtomicReference<>();
 
+    public FileUserGroupProvider() {
+    }
+
     @Override
     public void initialize(UserGroupProviderInitializationContext 
initializationContext) throws AuthorizerCreationException {
         try {

http://git-wip-us.apache.org/repos/asf/nifi/blob/4aac5283/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index ae44689..68bb87a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -706,7 +706,95 @@
                 </pluginManagement>
             </build>
         </profile>
-        <!-- The following profiles are here as a convenience for folks that 
+        <profile>
+            <!-- This profile, activating when compiling on Java 9, provides 
configuration changes to allow
+                 NiFi to be compiled on Java 9. -->
+            <id>java9</id>
+            <activation>
+                <jdk>9</jdk>
+            </activation>
+            <pluginRepositories>
+                <pluginRepository>
+                    <id>bintray</id>
+                    <name>Groovy Bintray</name>
+                    <url>https://dl.bintray.com/groovy/maven</url>
+                    <releases>
+                        <updatePolicy>never</updatePolicy>
+                    </releases>
+                    <snapshots>
+                        <enabled>false</enabled>
+                    </snapshots>
+                </pluginRepository>
+            </pluginRepositories>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-compiler-plugin</artifactId>
+                        <version>3.7.0</version>
+                        <executions>
+                            <!-- Only run for tests -->
+                            <execution>
+                                <id>groovy-tests</id>
+                                <goals>
+                                    <goal>testCompile</goal>
+                                </goals>
+                                <configuration>
+                                    
<compilerId>groovy-eclipse-compiler</compilerId>
+                                </configuration>
+                            </execution>
+                        </executions>
+                        <configuration>
+                            <source>9</source>
+                            <target>9</target>
+                            <compilerArgs>
+                                <arg>--add-modules=java.xml.bind</arg>
+                            </compilerArgs>
+                        </configuration>
+                        <dependencies>
+                            <dependency>
+                                <groupId>org.codehaus.groovy</groupId>
+                                
<artifactId>groovy-eclipse-compiler</artifactId>
+                                <version>2.9.3-01</version>
+                            </dependency>
+                            <dependency>
+                                <groupId>org.codehaus.groovy</groupId>
+                                <artifactId>groovy-eclipse-batch</artifactId>
+                                <version>2.4.15-01</version>
+                            </dependency>
+                        </dependencies>
+                    </plugin>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-jdeps-plugin</artifactId>
+                        <version>3.1.1</version>
+                        <executions>
+                            <execution>
+                                <goals>
+                                    <goal>jdkinternals</goal> <!-- verify main 
classes -->
+                                    <goal>test-jdkinternals</goal> <!-- verify 
test classes -->
+                                </goals>
+                            </execution>
+                        </executions>
+                        <configuration>
+                        </configuration>
+                    </plugin>
+                    <plugin>
+                        <groupId>org.antlr</groupId>
+                        <artifactId>antlr4-maven-plugin</artifactId>
+                        <version>4.7.1</version>
+                        <executions>
+                            <execution>
+                                <goals>
+                                    <goal>antlr4</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+        <!-- The following profiles are here as a convenience for folks that
             want to build against vendor-specific distributions of the various 
Hadoop 
             ecosystem libraries. These will alter which dependencies are 
sourced in a 
             manner that can adjust the correct LICENSE and NOTICE requirements 
for any 
@@ -798,13 +886,5 @@
                     should be overridden on the command-line 
<hadoop.version>2.6.0-cdh5.8.1</hadoop.version> -->
             </properties>
         </profile>
-        <profile>
-            <id>java9</id>
-            <activation>
-                <jdk>9</jdk>
-            </activation>
-            <build>
-            </build>
-        </profile>
     </profiles>
 </project>

Reply via email to