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/12/09 11:39:58 UTC
[maven-surefire] branch master updated (0f24a5c -> 9c44374)
This is an automated email from the ASF dual-hosted git repository.
tibordigana pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git.
from 0f24a5c [maven-release-plugin] prepare for next development iteration
new 3e0ee79 fixed test LongWindowsPathIT on Windows - canonical TEMP
new 59a0976 workspace in TMP for Windows builds
new 9c44374 [SUREFIRE-1608] dump error paths with the same root cause in Boot Manifest-JAR only once without stacktrace
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
Jenkinsfile | 4 +-
.../booterclient/JarManifestForkConfiguration.java | 53 +++++++++++++++++-----
.../JarManifestForkConfigurationTest.java | 26 ++++++-----
.../maven/surefire/its/LongWindowsPathIT.java | 2 +-
4 files changed, 60 insertions(+), 25 deletions(-)
[maven-surefire] 03/03: [SUREFIRE-1608] dump error paths with the
same root cause in Boot Manifest-JAR only once without stacktrace
Posted by ti...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tibordigana pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
commit 9c443740b26caebe9be20925906778f489cd3b33
Author: Tibor17 <ti...@apache.org>
AuthorDate: Fri Dec 7 01:23:34 2018 +0100
[SUREFIRE-1608] dump error paths with the same root cause in Boot Manifest-JAR only once without stacktrace
---
.../booterclient/JarManifestForkConfiguration.java | 53 +++++++++++++++++-----
.../JarManifestForkConfigurationTest.java | 26 ++++++-----
2 files changed, 56 insertions(+), 23 deletions(-)
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/JarManifestForkConfiguration.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/JarManifestForkConfiguration.java
index 79db5c6..62fa4c1 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/JarManifestForkConfiguration.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/JarManifestForkConfiguration.java
@@ -45,6 +45,7 @@ import java.util.jar.Manifest;
import static java.nio.file.Files.isDirectory;
import static org.apache.maven.plugin.surefire.SurefireHelper.escapeToPlatformPath;
+import static org.apache.maven.surefire.util.internal.StringUtils.NL;
/**
* @author <a href="mailto:tibordigana@apache.org">Tibor Digana (tibor17)</a>
@@ -113,15 +114,20 @@ public final class JarManifestForkConfiguration
Manifest man = new Manifest();
+ boolean dumpError = true;
+
// we can't use StringUtils.join here since we need to add a '/' to
// the end of directory entries - otherwise the jvm will ignore them.
StringBuilder cp = new StringBuilder();
for ( Iterator<String> it = classPath.iterator(); it.hasNext(); )
{
Path classPathElement = Paths.get( it.next() );
- String uri = toClasspathElementUri( parent, classPathElement, dumpLogDirectory );
- cp.append( uri );
- if ( isDirectory( classPathElement ) && !uri.endsWith( "/" ) )
+ ClasspathElementUri classpathElementUri =
+ toClasspathElementUri( parent, classPathElement, dumpLogDirectory, dumpError );
+ // too many errors in dump file with the same root cause may slow down the Boot Manifest-JAR startup
+ dumpError &= !classpathElementUri.absolute;
+ cp.append( classpathElementUri.uri );
+ if ( isDirectory( classPathElement ) && !classpathElementUri.uri.endsWith( "/" ) )
{
cp.append( '/' );
}
@@ -158,9 +164,10 @@ public final class JarManifestForkConfiguration
.toASCIIString();
}
- static String toClasspathElementUri( @Nonnull Path parent,
+ static ClasspathElementUri toClasspathElementUri( @Nonnull Path parent,
@Nonnull Path classPathElement,
- @Nonnull File dumpLogDirectory )
+ @Nonnull File dumpLogDirectory,
+ boolean dumpError )
throws IOException
{
try
@@ -168,16 +175,22 @@ public final class JarManifestForkConfiguration
String relativeUriPath = relativize( parent, classPathElement )
.replace( '\\', '/' );
- return new URI( null, relativeUriPath, null )
- .toASCIIString();
+ return new ClasspathElementUri( new URI( null, relativeUriPath, null ) );
}
catch ( IllegalArgumentException e )
{
- String error = "Boot Manifest-JAR contains absolute paths in classpath " + classPathElement;
- InPluginProcessDumpSingleton.getSingleton()
- .dumpException( e, error, dumpLogDirectory );
+ if ( dumpError )
+ {
+ String error = "Boot Manifest-JAR contains absolute paths in classpath '"
+ + classPathElement
+ + "'"
+ + NL
+ + "Hint: <argLine>-Djdk.net.URLClassPath.disableClassPathURLCheck=true</argLine>";
+ InPluginProcessDumpSingleton.getSingleton()
+ .dumpStreamText( error, dumpLogDirectory );
+ }
- return toAbsoluteUri( classPathElement );
+ return new ClasspathElementUri( toAbsoluteUri( classPathElement ) );
}
catch ( URISyntaxException e )
{
@@ -188,4 +201,22 @@ public final class JarManifestForkConfiguration
+ parent, e );
}
}
+
+ static final class ClasspathElementUri
+ {
+ final String uri;
+ final boolean absolute;
+
+ ClasspathElementUri( String uri )
+ {
+ this.uri = uri;
+ absolute = true;
+ }
+
+ ClasspathElementUri( URI uri )
+ {
+ this.uri = uri.toASCIIString();
+ absolute = false;
+ }
+ }
}
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/JarManifestForkConfigurationTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/JarManifestForkConfigurationTest.java
index 18b205a..5e71238 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/JarManifestForkConfigurationTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/JarManifestForkConfigurationTest.java
@@ -24,6 +24,7 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.Path;
+import org.apache.maven.plugin.surefire.booterclient.JarManifestForkConfiguration.ClasspathElementUri;
import org.apache.maven.plugin.surefire.booterclient.output.InPluginProcessDumpSingleton;
import static org.apache.maven.plugin.surefire.booterclient.JarManifestForkConfiguration.relativize;
@@ -38,6 +39,7 @@ import org.junit.runner.RunWith;
import static org.fest.util.Files.delete;
import static org.fest.util.Files.newTemporaryFolder;
+import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.same;
import static org.powermock.api.mockito.PowerMockito.mock;
import static org.powermock.api.mockito.PowerMockito.mockStatic;
@@ -84,9 +86,9 @@ public class JarManifestForkConfigurationTest
when( classPathElement.toString() ).thenReturn( "/home/me/.m2/repository/grp/art/1.0/art-1.0.jar" );
when( relativize( parent, classPathElement ) )
.thenReturn( "../../../.m2/repository/grp/art/1.0/art-1.0.jar" );
- when( toClasspathElementUri( same( parent ), same( classPathElement ), same( dumpDirectory ) ) )
+ when( toClasspathElementUri( same( parent ), same( classPathElement ), same( dumpDirectory ), anyBoolean() ) )
.thenCallRealMethod();
- assertThat( toClasspathElementUri( parent, classPathElement, dumpDirectory ) )
+ assertThat( toClasspathElementUri( parent, classPathElement, dumpDirectory, true ).uri )
.isEqualTo( "../../../.m2/repository/grp/art/1.0/art-1.0.jar" );
}
@@ -101,9 +103,9 @@ public class JarManifestForkConfigurationTest
when( classPathElement.toString() ).thenReturn( "/the Maven repo/grp/art/1.0/art-1.0.jar" );
when( relativize( parent, classPathElement ) )
.thenReturn( "../../../../../the Maven repo/grp/art/1.0/art-1.0.jar" );
- when( toClasspathElementUri( same( parent ), same( classPathElement ), same( dumpDirectory ) ) )
+ when( toClasspathElementUri( same( parent ), same( classPathElement ), same( dumpDirectory ), anyBoolean() ) )
.thenCallRealMethod();
- assertThat( toClasspathElementUri( parent, classPathElement, dumpDirectory ) )
+ assertThat( toClasspathElementUri( parent, classPathElement, dumpDirectory, true ).uri )
.isEqualTo( "../../../../../the%20Maven%20repo/grp/art/1.0/art-1.0.jar" );
}
@@ -118,9 +120,9 @@ public class JarManifestForkConfigurationTest
when( classPathElement.toString() ).thenReturn( "C:\\Users\\me\\.m2\\repository\\grp\\art\\1.0\\art-1.0.jar" );
when( relativize( parent, classPathElement ) )
.thenReturn( "..\\..\\..\\Users\\me\\.m2\\repository\\grp\\art\\1.0\\art-1.0.jar" );
- when( toClasspathElementUri( same( parent ), same( classPathElement ), same( dumpDirectory ) ) )
+ when( toClasspathElementUri( same( parent ), same( classPathElement ), same( dumpDirectory ), anyBoolean() ) )
.thenCallRealMethod();
- assertThat( toClasspathElementUri( parent, classPathElement, dumpDirectory ) )
+ assertThat( toClasspathElementUri( parent, classPathElement, dumpDirectory, true ).uri )
.isEqualTo( "../../../Users/me/.m2/repository/grp/art/1.0/art-1.0.jar" );
}
@@ -135,9 +137,9 @@ public class JarManifestForkConfigurationTest
when( classPathElement.toString() ).thenReturn( "C:\\Test User\\me\\.m2\\repository\\grp\\art\\1.0\\art-1.0.jar" );
when( relativize( parent, classPathElement ) )
.thenReturn( "..\\..\\..\\Test User\\me\\.m2\\repository\\grp\\art\\1.0\\art-1.0.jar" );
- when( toClasspathElementUri( same( parent ), same( classPathElement ), same( dumpDirectory ) ) )
+ when( toClasspathElementUri( same( parent ), same( classPathElement ), same( dumpDirectory ), anyBoolean() ) )
.thenCallRealMethod();
- assertThat( toClasspathElementUri( parent, classPathElement, dumpDirectory ) )
+ assertThat( toClasspathElementUri( parent, classPathElement, dumpDirectory, true ).uri )
.isEqualTo( "../../../Test%20User/me/.m2/repository/grp/art/1.0/art-1.0.jar" );
}
@@ -164,11 +166,11 @@ public class JarManifestForkConfigurationTest
} );
when( relativize( same( parent ), same( classPathElement ) ) )
.thenThrow( new IllegalArgumentException() );
- when( toClasspathElementUri( same( parent ), same( classPathElement ), same( dumpDirectory ) ) )
+ when( toClasspathElementUri( same( parent ), same( classPathElement ), same( dumpDirectory ), anyBoolean() ) )
.thenCallRealMethod();
when( toAbsoluteUri( same( classPathElement ) ) )
.thenCallRealMethod();
- assertThat( toClasspathElementUri( parent, classPathElement, dumpDirectory ) )
+ assertThat( toClasspathElementUri( parent, classPathElement, dumpDirectory, true ).uri )
.isEqualTo( "file:///X:/Users/me/.m2/repository/grp/art/1.0/art-1.0.jar" );
}
@@ -213,9 +215,9 @@ public class JarManifestForkConfigurationTest
Path testDir = new File( TMP, "@3 test with white spaces" )
.toPath();
- String testDirUriPath = toClasspathElementUri( parentDir, testDir, dumpDirectory );
+ ClasspathElementUri testDirUriPath = toClasspathElementUri( parentDir, testDir, dumpDirectory, true );
- assertThat( testDirUriPath )
+ assertThat( testDirUriPath.uri )
.isEqualTo( "../@3%20test%20with%20white%20spaces" );
}
}
[maven-surefire] 01/03: fixed test LongWindowsPathIT on Windows -
canonical TEMP
Posted by ti...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tibordigana pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
commit 3e0ee79a52f0ef5e76648592bf86202ad2d381fc
Author: Tibor17 <ti...@apache.org>
AuthorDate: Thu Dec 6 23:51:12 2018 +0100
fixed test LongWindowsPathIT on Windows - canonical TEMP
---
.../src/test/java/org/apache/maven/surefire/its/LongWindowsPathIT.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/LongWindowsPathIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/LongWindowsPathIT.java
index 6280835..551c18b 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/LongWindowsPathIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/LongWindowsPathIT.java
@@ -76,7 +76,7 @@ public class LongWindowsPathIT
else if ( line.contains( "SUREFIRE-1400 surefire.real.class.path=" ) )
{
assertThat( line )
- .contains( System.getProperty( "java.io.tmpdir" ) );
+ .contains( new File( System.getProperty( "java.io.tmpdir" ) ).getCanonicalPath() );
}
}
}
[maven-surefire] 02/03: workspace in TMP for Windows builds
Posted by ti...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tibordigana pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
commit 59a0976c7278159c3a88502ad17c415562de4b57
Author: Tibor17 <ti...@apache.org>
AuthorDate: Fri Dec 7 01:24:26 2018 +0100
workspace in TMP for Windows builds
---
Jenkinsfile | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 365035b..87c8cca 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -66,7 +66,9 @@ oses.eachWithIndex { osMapping, indexOfOs ->
def boolean makeReports = indexOfOs == 0 && indexOfMaven == 0 && indexOfJdk == 0
def failsafeItPort = 8000 + 100 * indexOfMaven + 10 * indexOfJdk
def allOptions = options + ["-Dfailsafe-integration-test-port=${failsafeItPort}", "-Dfailsafe-integration-test-stop-port=${1 + failsafeItPort}"]
- buildProcess(stageKey, jdkName, jdkTestName, mvnName, goals, allOptions, mavenOpts, makeReports)
+ ws(dir: "${os == 'windows' ? "${TEMP}\\${BUILD_TAG}" : pwd()}") {
+ buildProcess(stageKey, jdkName, jdkTestName, mvnName, goals, allOptions, mavenOpts, makeReports)
+ }
}
}
}