[
https://issues.apache.org/jira/browse/SUREFIRE-1588?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16674389#comment-16674389
]
ASF GitHub Bot commented on SUREFIRE-1588:
------------------------------------------
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:
[email protected]
> 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
> Assignee: Tibor Digana
> Priority: Major
> Fix For: 3.0.0-M1
>
>
> 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)