maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SUREFIRE-1588) Surefire manifest jar classloading broken on latest Debian/Ubuntu Java8
Date Thu, 01 Nov 2018 17:52:00 GMT

    [ https://issues.apache.org/jira/browse/SUREFIRE-1588?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16671933#comment-16671933
] 

ASF GitHub Bot commented on SUREFIRE-1588:
------------------------------------------

jglick commented on a change in pull request #197: SUREFIRE-1588 Patch (Java7)
URL: https://github.com/apache/maven-surefire/pull/197#discussion_r230134884
 
 

 ##########
 File path: maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/JarManifestForkConfiguration.java
 ##########
 @@ -111,7 +114,17 @@ 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 = URI.create( parent.relativize( file1.toPath() ).toString() ).toASCIIString();
 
 Review comment:
   There is a reason I suggested the three-arg `URI` constructor rather than `create`. You
want to _construct_ a URI from a raw path, not _parse_ a URI.
   
   ```
   jshell> URI.create("../../a b/c.jar")
   |  java.lang.IllegalArgumentException thrown: Illegal character in path at index 7: ../../a
b/c.jar
   |        at URI.create (URI.java:883)
   |        at (#6:1)
   
   jshell> new URI(null, "../../a b/c.jar", null)
   $7 ==> ../../a%20b/c.jar
   ```

----------------------------------------------------------------
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


> Surefire manifest jar classloading broken on latest Debian/Ubuntu Java8
> -----------------------------------------------------------------------
>
>                 Key: SUREFIRE-1588
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1588
>             Project: Maven Surefire
>          Issue Type: Bug
>    Affects Versions: 2.22.1
>            Reporter: Cservenak, Tamas
>            Priority: Major
>
> See issue [1], but in short: latest Java8 on Ubuntu/Debian/Mint family of Linuxes (am
on Mint, Ubuntu derivative) contains this patch [3], and eforces Manifest class path entries
to be relative, as defined in [2].
> Hence, surefire booter and rest of Maven classpath, that uses absolute URLs are simply
discarded.
> Example error:
> {noformat}
> # Created at 2018-10-30T21:34:43.339
> Error: Could not find or load main class org.apache.maven.surefire.booter.ForkedBooter{noformat}
> using the new property {{-Djdk.net.URLClassPath.disableClassPathURLCheck=debug}} clearly
shows that all the entries from the surefire JAR are simply ignored.
>  
> [1] [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=911925]
> [2] https://docs.oracle.com/javase/8/docs/technotes/guides/jar/jar.html#classpath
> [3] [https://hg.openjdk.java.net/jdk/jdk/rev/27135de165ac]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message