You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2018/11/04 11:30:36 UTC

[GitHub] cstamas closed pull request #197: SUREFIRE-1588 Patch (Java7)

cstamas closed pull request #197: SUREFIRE-1588 Patch (Java7)
URL: https://github.com/apache/maven-surefire/pull/197
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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 3bcf7a322..c8e90f9aa 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
@@ -30,6 +30,9 @@
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.nio.file.Path;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -95,6 +98,7 @@ private File createJar( @Nonnull List<String> classPath, @Nonnull String startCl
         {
             file.deleteOnExit();
         }
+        Path parent = file.getParentFile().toPath();
         FileOutputStream fos = new FileOutputStream( file );
         JarOutputStream jos = new JarOutputStream( fos );
         try
@@ -111,7 +115,21 @@ private File createJar( @Nonnull List<String> classPath, @Nonnull String startCl
             for ( Iterator<String> it = classPath.iterator(); it.hasNext(); )
             {
                 File file1 = new File( it.next() );
-                String uri = file1.toURI().toASCIIString();
+                String uri;
+                try
+                {
+                    uri = new URI( null, parent.relativize( file1.toPath() ).toString(), null ).toASCIIString();
+                }
+                catch ( IllegalArgumentException e )
+                {
+                    uri = file1.toURI().toASCIIString();
+                }
+                catch ( URISyntaxException e )
+                {
+                    // This is really unexpected, so fail
+                    throw new IOException( "Could not relativize path " + file1 + " against " + parent, e );
+                }
+
                 cp.append( uri );
                 if ( file1.isDirectory() && !uri.endsWith( "/" ) )
                 {
diff --git a/pom.xml b/pom.xml
index ce0756c8d..024c4a532 100644
--- a/pom.xml
+++ b/pom.xml
@@ -84,6 +84,7 @@
   </distributionManagement>
 
   <properties>
+    <javaVersion>7</javaVersion>
     <mavenVersion>2.2.1</mavenVersion>
     <!-- <shadedVersion>2.12.4</shadedVersion> commented out due to https://issues.apache.org/jira/browse/MRELEASE-799 -->
     <commonsLang3Version>3.5</commonsLang3Version>
@@ -434,8 +435,8 @@
               <configuration>
                 <signature>
                   <groupId>org.codehaus.mojo.signature</groupId>
-                  <artifactId>java16</artifactId>
-                  <version>1.1</version>
+                  <artifactId>java17</artifactId>
+                  <version>1.0</version>
                 </signature>
                 <excludeDependencies>
                   <param>org.codehaus.plexus:plexus-java</param>


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services