You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2018/09/10 18:31:53 UTC
[maven-surefire] 02/03: [SUREFIRE-1562] Support Java 11
This is an automated email from the ASF dual-hosted git repository.
tibordigana pushed a commit to branch BUILDFIX
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
commit 3faa92c48fa72fee28607f970b3e06b05888c4b7
Author: Tibor17 <ti...@apache.org>
AuthorDate: Mon Sep 10 02:35:21 2018 +0200
[SUREFIRE-1562] Support Java 11
---
Jenkinsfile | 7 +++--
maven-surefire-common/pom.xml | 10 ++++++++
pom.xml | 30 ++++++++++++++++++----
surefire-booter/pom.xml | 10 ++++++++
.../apache/maven/surefire/its/Java9FullApiIT.java | 9 ++++---
.../maven/surefire/its/WorkingDirectoryIT.java | 11 ++++----
.../surefire/its/fixture/HelperAssertions.java | 2 +-
.../surefire/its/fixture/SurefireLauncher.java | 8 +++---
.../child/src/test/java/workingDir/BasicTest.java | 3 ++-
9 files changed, 68 insertions(+), 22 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 258e42f..9de3f2f 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -30,9 +30,9 @@ properties(
]
)
-final def oses = ['linux':'ubuntu', 'windows':'Windows']
+final def oses = ['linux':'ubuntu && !H24', 'windows':'Windows']
final def mavens = env.BRANCH_NAME == 'master' ? ['3.2.x', '3.3.x', '3.5.x'] : ['3.5.x']
-final def jdks = [7, 8, 9, 10]
+final def jdks = [7, 8, 9, 10, 11]
final def options = ['-e', '-V', '-B', '-nsu', '-P', 'run-its']
final def goals = ['clean', 'install', 'jacoco:report']
@@ -71,6 +71,9 @@ oses.eachWithIndex { osMapping, indexOfOs ->
def boolean makeReports = os == 'linux' && indexOfMaven == mavens.size() - 1 && jdk == 9
def failsafeItPort = 8000 + 100 * indexOfMaven + 10 * indexOfJdk
def allOptions = options + ["-Dfailsafe-integration-test-port=${failsafeItPort}", "-Dfailsafe-integration-test-stop-port=${1 + failsafeItPort}"]
+ if (jdk == 11) {
+ allOptions += ['-DskipUnitTests=true']
+ }
buildProcess(stageKey, jdkName, jdkTestName, mvnName, goals, allOptions, mavenOpts, makeReports)
}
}
diff --git a/maven-surefire-common/pom.xml b/maven-surefire-common/pom.xml
index 2fa3436..60b547d 100644
--- a/maven-surefire-common/pom.xml
+++ b/maven-surefire-common/pom.xml
@@ -127,6 +127,16 @@
<artifactId>powermock-api-mockito2</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>net.bytebuddy</groupId>
+ <artifactId>byte-buddy</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>net.bytebuddy</groupId>
+ <artifactId>byte-buddy-agent</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
diff --git a/pom.xml b/pom.xml
index 300fcce..564ed40 100644
--- a/pom.xml
+++ b/pom.xml
@@ -260,12 +260,12 @@
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-java</artifactId>
- <version>0.9.8</version>
+ <version>0.9.9</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
- <version>2.13.0</version>
+ <version>2.21.0</version>
<exclusions>
<exclusion>
<groupId>org.hamcrest</groupId>
@@ -273,7 +273,7 @@
</exclusion>
</exclusions>
</dependency>
- <!-- PowerMock@Java9
+ <!-- PowerMock@Java9 and Java11
org.powermock for java9, see https://github.com/powermock/powermock/issues/783
These dependencies substitute org.powermock:powermock-mockito-release-full:jar:full:1.6.4 in java9.
-->
@@ -282,6 +282,26 @@
<artifactId>powermock-core</artifactId>
<version>${powermockVersion}</version>
<scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>net.bytebuddy</groupId>
+ <artifactId>byte-buddy</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>net.bytebuddy</groupId>
+ <artifactId>byte-buddy-agent</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>net.bytebuddy</groupId>
+ <artifactId>byte-buddy</artifactId>
+ <version>1.8.17</version>
+ </dependency>
+ <dependency>
+ <groupId>net.bytebuddy</groupId>
+ <artifactId>byte-buddy-agent</artifactId>
+ <version>1.8.17</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
@@ -440,7 +460,7 @@
<configuration>
<!-- NOTE: Be sure to isolate the Surefire version under test from the version running the tests! -->
<useSystemClassLoader>false</useSystemClassLoader>
- <argLine>${jvm.args.tests} ${jacoco.agent}</argLine>
+ <argLine>${jvm.args.tests} ${jacoco.agent} -Dnet.bytebuddy.experimental=true</argLine>
<useFile>false</useFile>
<redirectTestOutputToFile>false</redirectTestOutputToFile>
<jvm>${jdk.home}/bin/java</jvm>
@@ -472,7 +492,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
- <version>0.8.1</version>
+ <version>0.8.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
diff --git a/surefire-booter/pom.xml b/surefire-booter/pom.xml
index 044fb83..0760303 100644
--- a/surefire-booter/pom.xml
+++ b/surefire-booter/pom.xml
@@ -80,6 +80,16 @@
<artifactId>powermock-api-mockito2</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>net.bytebuddy</groupId>
+ <artifactId>byte-buddy</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>net.bytebuddy</groupId>
+ <artifactId>byte-buddy-agent</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/Java9FullApiIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/Java9FullApiIT.java
index 165d745..ec9a688 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/Java9FullApiIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/Java9FullApiIT.java
@@ -56,7 +56,8 @@ public class Java9FullApiIT
.verifyTextInLog( "loaded class javax.transaction.TransactionManager" )
.verifyTextInLog( "loaded class javax.transaction.InvalidTransactionException" )
.assertThatLogLine( anyOf( is( "java.specification.version=9" ),
- is( "java.specification.version=10" ) ),
+ is( "java.specification.version=10" ),
+ is( "java.specification.version=11" ) ),
greaterThanOrEqualTo( 1 ) );
}
@@ -76,7 +77,8 @@ public class Java9FullApiIT
.verifyTextInLog( "loaded class javax.transaction.TransactionManager" )
.verifyTextInLog( "loaded class javax.transaction.InvalidTransactionException" )
.assertThatLogLine( anyOf( is( "java.specification.version=9" ),
- is( "java.specification.version=10" ) ),
+ is( "java.specification.version=10" ),
+ is( "java.specification.version=11" ) ),
greaterThanOrEqualTo( 1 ) );
}
@@ -97,7 +99,8 @@ public class Java9FullApiIT
.verifyTextInLog( "loaded class javax.transaction.TransactionManager" )
.verifyTextInLog( "loaded class javax.transaction.InvalidTransactionException" )
.assertThatLogLine( anyOf( is( "java.specification.version=9" ),
- is( "java.specification.version=10" ) ),
+ is( "java.specification.version=10" ),
+ is( "java.specification.version=11" ) ),
greaterThanOrEqualTo( 1 ) );
}
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/WorkingDirectoryIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/WorkingDirectoryIT.java
index 66fa3df..7800f4b 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/WorkingDirectoryIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/WorkingDirectoryIT.java
@@ -47,6 +47,7 @@ public class WorkingDirectoryIT
{
final SurefireLauncher unpack = getUnpacked();
final OutputValidator child = getPreparedChild( unpack );
+ child.getTargetFile( "out.txt" ).delete();
unpack.executeTest().verifyErrorFreeLog();
child.assertTestSuiteResults( 1, 0, 0, 0 );
verifyOutputDirectory( child );
@@ -58,6 +59,7 @@ public class WorkingDirectoryIT
{
final SurefireLauncher unpack = getUnpacked();
final OutputValidator child = getPreparedChild( unpack );
+ child.getTargetFile( "out.txt" ).delete();
unpack.forkNever().executeTest().verifyErrorFreeLog();
child.assertTestSuiteResults( 1, 0, 0, 0 );
verifyOutputDirectory( child );
@@ -69,7 +71,7 @@ public class WorkingDirectoryIT
{
final SurefireLauncher unpack = getUnpacked();
final SurefireLauncher child = unpack.getSubProjectLauncher( "child" );
- //child.getTargetFile( "out.txt" ).delete();
+ child.getSubProjectValidator( "child" ).getTargetFile( "out.txt" ).delete();
final OutputValidator outputValidator = child.executeTest().assertTestSuiteResults( 1, 0, 0, 0 );
verifyOutputDirectory( outputValidator );
}
@@ -78,16 +80,14 @@ public class WorkingDirectoryIT
public void testWorkingDirectoryChildOnlyNoFork()
throws Exception
{
-
final SurefireLauncher unpack = getUnpacked();
final SurefireLauncher child = unpack.getSubProjectLauncher( "child" );
- //child.getTargetFile( "out.txt" ).delete();
+ child.getSubProjectValidator( "child" ).getTargetFile( "out.txt" ).delete();
final OutputValidator outputValidator = child.forkNever().executeTest().assertTestSuiteResults( 1, 0, 0, 0 );
verifyOutputDirectory( outputValidator );
}
private SurefireLauncher getUnpacked()
- throws VerificationException, IOException
{
return unpack( "working-directory" );
}
@@ -106,7 +106,7 @@ public class WorkingDirectoryIT
return child.getTargetFile( "out.txt" );
}
- public void verifyOutputDirectory( OutputValidator childTestDir )
+ private void verifyOutputDirectory( OutputValidator childTestDir )
throws IOException
{
final TestFile outFile = getOutFile( childTestDir );
@@ -130,5 +130,4 @@ public class WorkingDirectoryIT
userDir.getCanonicalPath() );
}
}
-
}
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/HelperAssertions.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/HelperAssertions.java
index 3e753de..5bea87e 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/HelperAssertions.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/HelperAssertions.java
@@ -170,7 +170,7 @@ public class HelperAssertions
{
String thisVersion = System.getProperty( "java.specification.version" );
assumeTrue( "java.specification.version: " + thisVersion,
- Double.valueOf( thisVersion ) >= expectedVersion );
+ Double.parseDouble( thisVersion ) >= expectedVersion );
}
public static String convertUnicodeToUTF8( String unicode )
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java
index 0d23f90..5ec5e09 100755
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java
@@ -126,15 +126,15 @@ public final class SurefireLauncher
return mavenLauncher.getSubProjectValidator( subProject );
}
- public SurefireLauncher addEnvVar( String key, String value )
+ private SurefireLauncher addEnvVar( String key, String value )
{
mavenLauncher.addEnvVar( key, value );
return this;
}
- public SurefireLauncher setMavenOpts(String opts){
- addEnvVar( "MAVEN_OPTS", opts );
- return this;
+ public SurefireLauncher setMavenOpts(String opts)
+ {
+ return addEnvVar( "MAVEN_OPTS", opts );
}
private List<String> getInitialGoals()
diff --git a/surefire-its/src/test/resources/working-directory/child/src/test/java/workingDir/BasicTest.java b/surefire-its/src/test/resources/working-directory/child/src/test/java/workingDir/BasicTest.java
index 1708202..e6621fb 100644
--- a/surefire-its/src/test/resources/working-directory/child/src/test/java/workingDir/BasicTest.java
+++ b/surefire-its/src/test/resources/working-directory/child/src/test/java/workingDir/BasicTest.java
@@ -31,8 +31,9 @@ public class BasicTest
public void testWorkingDir()
throws Exception
{
- File target = new File( "target" ).getAbsoluteFile();
+ File target = new File( System.getProperty( "user.dir" ), "target" ).getAbsoluteFile();
File outFile = new File( target, "out.txt" );
+ assertTrue( outFile.createNewFile() );
FileOutputStream os = new FileOutputStream( outFile );
String userDir = System.getProperty( "user.dir" );
Properties p = new Properties();