maven-surefire git commit: [SUREFIRE-1424] javax.transaction.TransactionManager not visible with Java9

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

maven-surefire git commit: [SUREFIRE-1424] javax.transaction.TransactionManager not visible with Java9

Tibor Digana
Repository: maven-surefire
Updated Branches:
  refs/heads/master 81b9bbbee -> 7ac85f283


[SUREFIRE-1424] javax.transaction.TransactionManager not visible with Java9


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/7ac85f28
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/7ac85f28
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/7ac85f28

Branch: refs/heads/master
Commit: 7ac85f283a08fa8d0b447ca5685f545ae8acdc9d
Parents: 81b9bbb
Author: Enrico Olivelli <[hidden email]>
Authored: Thu Nov 23 16:58:23 2017 +0100
Committer: Tibor17 <[hidden email]>
Committed: Sat Dec 2 16:35:00 2017 +0100

----------------------------------------------------------------------
 .../AbstractClasspathForkConfiguration.java     | 12 +-----
 .../src/site/markdown/java9.md                  | 39 +++++++++++++++++++-
 .../maven/surefire/its/Java9FullApiIT.java      | 15 +++++---
 .../src/test/resources/java9-full-api/pom.xml   | 15 ++++++++
 .../java9-full-api/src/test/java/J9IT.java      |  8 ++--
 .../java9-full-api/src/test/java/J9Test.java    |  7 +---
 6 files changed, 67 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/7ac85f28/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/AbstractClasspathForkConfiguration.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/AbstractClasspathForkConfiguration.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/AbstractClasspathForkConfiguration.java
index 90d1a1d..5834dfb 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/AbstractClasspathForkConfiguration.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/AbstractClasspathForkConfiguration.java
@@ -35,9 +35,6 @@ import java.util.Properties;
 abstract class AbstractClasspathForkConfiguration
         extends DefaultForkConfiguration
 {
-    private static final String ADD_MODULES = "--add-modules";
-    private static final String ADD_MODULES_VALUE = "java.se.ee";
-    private static final String ALL_JAVA_API = ADD_MODULES + " " + ADD_MODULES_VALUE;
 
     @SuppressWarnings( "checkstyle:parameternumber" )
     public AbstractClasspathForkConfiguration( @Nonnull Classpath bootClasspath,
@@ -61,13 +58,6 @@ abstract class AbstractClasspathForkConfiguration
     @Nonnull
     protected String extendJvmArgLine( @Nonnull String jvmArgLine )
     {
-        if ( getJdkForTests().isJava9AtLeast() && !jvmArgLine.contains( ADD_MODULES ) )
-        {
-            return jvmArgLine.isEmpty() ? ALL_JAVA_API : ALL_JAVA_API + " " + jvmArgLine;
-        }
-        else
-        {
-            return jvmArgLine;
-        }
+        return jvmArgLine;
     }
 }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/7ac85f28/maven-surefire-plugin/src/site/markdown/java9.md
----------------------------------------------------------------------
diff --git a/maven-surefire-plugin/src/site/markdown/java9.md b/maven-surefire-plugin/src/site/markdown/java9.md
index e0f758f..4ba2567 100644
--- a/maven-surefire-plugin/src/site/markdown/java9.md
+++ b/maven-surefire-plugin/src/site/markdown/java9.md
@@ -23,8 +23,43 @@ Java 9 in JAVA_HOME
     $ export JAVA_HOME=/path/to/jdk9
     $ mvn test
 
-The plugin will automatically add `--add-modules java.se.ee` on JVM argument in CLI (unless already specified by user)
-and all Java 9 API is provided to run your tests.
+Using JDK Deprecated Modules
+========================
+
+Since Java 9 some modules previously bundled with the JDK are disabled by default.
+
+Version 2.20.1 of the plugin added automatically "--add-modules java.se.ee" option to the command line of forked JVMs (unless already specified by user) in order to ease the transition of applications to Java 9.
+
+From 2.21 onwards the plugin will not add that option: the recommended way of using those modules is to add explicit dependencies of the maintained versions of such libraries.
+
+This is a reference of the versions which were bundled with Java 8:
+
+**Commons Annotations**
+
+javax.annotation:javax.annotation-api:1.3.1
+
+**JavaBeans Activation Framework**
+
+javax.activation:javax.activation-api:1.2.0
+
+**Java Transaction API**
+
+javax.transaction:javax.transaction-api:1.2
+
+**JAXB**
+
+javax.xml.bind:jaxb-api:2.3.0
+
+org.glassfish.jaxb:jaxb-runtime:2.3.0 (implementation)
+
+**JAX-WS**
+
+javax.xml.ws:jaxws-api:2.3.0
+
+com.sun.xml.ws:jaxws-rt:2.3.0 (implementation)
+
+The source code for each of these is maintained at [https://github.com/javaee](https://github.com/javaee)
+
 
 
 Java 9 in configuration of plugin

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/7ac85f28/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Java9FullApiIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Java9FullApiIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Java9FullApiIT.java
index b1bea12..22841ae 100644
--- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Java9FullApiIT.java
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Java9FullApiIT.java
@@ -43,12 +43,13 @@ public class Java9FullApiIT
                                             .setForkJvm()
                                             .debugLogging()
                                             .execute( "verify" )
-                                            .verifyErrorFree( 2 );
+                                            .verifyErrorFree( 1 );
 
         validator.verifyTextInLog( "loaded class java.sql.SQLException" )
                 .verifyTextInLog( "loaded class javax.xml.ws.Holder" )
                 .verifyTextInLog( "loaded class javax.xml.bind.JAXBException" )
-                .verifyTextInLog( "loaded class org.omg.CORBA.BAD_INV_ORDER" )
+                .verifyTextInLog( "loaded class javax.transaction.TransactionManager" )
+                .verifyTextInLog( "loaded class javax.transaction.InvalidTransactionException" )
                 .verifyTextInLog( "java.specification.version=9" );
     }
 
@@ -60,12 +61,13 @@ public class Java9FullApiIT
                                             .debugLogging()
                                             .sysProp( JDK_HOME_KEY, new File( JDK_HOME ).getCanonicalPath() )
                                             .execute( "verify" )
-                                            .verifyErrorFree( 2 );
+                                            .verifyErrorFree( 1 );
 
         validator.verifyTextInLog( "loaded class java.sql.SQLException" )
                 .verifyTextInLog( "loaded class javax.xml.ws.Holder" )
                 .verifyTextInLog( "loaded class javax.xml.bind.JAXBException" )
-                .verifyTextInLog( "loaded class org.omg.CORBA.BAD_INV_ORDER" )
+                .verifyTextInLog( "loaded class javax.transaction.TransactionManager" )
+                .verifyTextInLog( "loaded class javax.transaction.InvalidTransactionException" )
                 .verifyTextInLog( "java.specification.version=9" );
     }
 
@@ -78,12 +80,13 @@ public class Java9FullApiIT
                                             .addGoal( "--toolchains" )
                                             .addGoal( System.getProperty( "maven.toolchains.file" ) )
                                             .execute( "verify" )
-                                            .verifyErrorFree( 2 );
+                                            .verifyErrorFree( 1 );
 
         validator.verifyTextInLog( "loaded class java.sql.SQLException" )
                 .verifyTextInLog( "loaded class javax.xml.ws.Holder" )
                 .verifyTextInLog( "loaded class javax.xml.bind.JAXBException" )
-                .verifyTextInLog( "loaded class org.omg.CORBA.BAD_INV_ORDER" )
+                .verifyTextInLog( "loaded class javax.transaction.TransactionManager" )
+                .verifyTextInLog( "loaded class javax.transaction.InvalidTransactionException" )
                 .verifyTextInLog( "java.specification.version=9" );
     }
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/7ac85f28/surefire-integration-tests/src/test/resources/java9-full-api/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/java9-full-api/pom.xml b/surefire-integration-tests/src/test/resources/java9-full-api/pom.xml
index 7d9026e..dc44fb7 100644
--- a/surefire-integration-tests/src/test/resources/java9-full-api/pom.xml
+++ b/surefire-integration-tests/src/test/resources/java9-full-api/pom.xml
@@ -69,6 +69,21 @@
             <version>4.12</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>javax.transaction</groupId>
+            <artifactId>javax.transaction-api</artifactId>
+            <version>1.2</version>
+        </dependency>
+        <dependency>
+            <groupId>javax.xml.ws</groupId>
+            <artifactId>jaxws-api</artifactId>
+            <version>2.3.0</version>
+        </dependency>
+        <dependency>
+            <groupId>javax.xml.bind</groupId>
+            <artifactId>jaxb-api</artifactId>
+           <version>2.3.0</version>
+        </dependency>
     </dependencies>
 
     <profiles>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/7ac85f28/surefire-integration-tests/src/test/resources/java9-full-api/src/test/java/J9IT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/java9-full-api/src/test/java/J9IT.java b/surefire-integration-tests/src/test/resources/java9-full-api/src/test/java/J9IT.java
index 9daf55d..c74678d 100644
--- a/surefire-integration-tests/src/test/resources/java9-full-api/src/test/java/J9IT.java
+++ b/surefire-integration-tests/src/test/resources/java9-full-api/src/test/java/J9IT.java
@@ -27,13 +27,11 @@ public class J9IT
         System.out.println( "loaded class " + java.sql.SQLException.class.getName() );
         System.out.println( "loaded class " + javax.xml.ws.Holder.class.getName() );
         System.out.println( "loaded class " + javax.xml.bind.JAXBException.class.getName() );
-        System.out.println( "loaded class " + org.omg.CORBA.BAD_INV_ORDER.class.getName() );
+        System.out.println( "loaded class " + javax.transaction.InvalidTransactionException.class.getName() );
+        System.out.println( "from classloader " + javax.transaction.InvalidTransactionException.class.getClassLoader() );
+        System.out.println( "loaded class " + javax.transaction.TransactionManager.class.getName() );
         System.out.println( "loaded class " + javax.xml.xpath.XPath.class.getName() );
         System.out.println( "java.specification.version=" + System.getProperty( "java.specification.version" ) );
     }
 
-    @Test
-    public void test_corba_mod() throws org.omg.CORBA.BAD_INV_ORDER
-    {
-    }
 }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/7ac85f28/surefire-integration-tests/src/test/resources/java9-full-api/src/test/java/J9Test.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/java9-full-api/src/test/java/J9Test.java b/surefire-integration-tests/src/test/resources/java9-full-api/src/test/java/J9Test.java
index 6745d5f..6fc8536 100644
--- a/surefire-integration-tests/src/test/resources/java9-full-api/src/test/java/J9Test.java
+++ b/surefire-integration-tests/src/test/resources/java9-full-api/src/test/java/J9Test.java
@@ -27,13 +27,10 @@ public class J9Test
         System.out.println( "loaded class " + java.sql.SQLException.class.getName() );
         System.out.println( "loaded class " + javax.xml.ws.Holder.class.getName() );
         System.out.println( "loaded class " + javax.xml.bind.JAXBException.class.getName() );
-        System.out.println( "loaded class " + org.omg.CORBA.BAD_INV_ORDER.class.getName() );
+        System.out.println( "loaded class " + javax.transaction.InvalidTransactionException.class.getName() );
+        System.out.println( "loaded class " + javax.transaction.TransactionManager.class.getName() );
         System.out.println( "loaded class " + javax.xml.xpath.XPath.class.getName() );
         System.out.println( "java.specification.version=" + System.getProperty( "java.specification.version" ) );
     }
 
-    @Test
-    public void test_corba_mod() throws org.omg.CORBA.BAD_INV_ORDER
-    {
-    }
 }