Ekryd / sortpom

Maven plugin that helps the user sort pom.xml.
https://github.com/Ekryd/sortpom/wiki/
BSD 3-Clause "New" or "Revised" License
336 stars 181 forks source link

Fix "Boot Manifest-JAR contains absolute paths in classpath" error on Windows #423

Closed mches closed 5 months ago

mches commented 7 months ago

On Windows, if the Git repo and Maven local repo are on different drives such as E: and C: respectively, then there are errors from the Surefire plugin. This PR addresses that, if you're interested.

E:\...\sortpom\maven-plugin\target\surefire-reports\2024-04-13T11-42-35_408.dumpstream:

# Created at 2024-04-13T11:42:58.124
Boot Manifest-JAR contains absolute paths in classpath 'E:\...\sortpom\maven-plugin\target\test-classes'
Hint: <argLine>-Djdk.net.URLClassPath.disableClassPathURLCheck=true</argLine>
'other' has different root

E:\...\sortpom\sorter\target\surefire-reports\2024-04-13T11-42-35_408.dumpstream:

# Created at 2024-04-13T11:42:35.560
Boot Manifest-JAR contains absolute paths in classpath 'E:\...\sortpom\sorter\target\test-classes'
Hint: <argLine>-Djdk.net.URLClassPath.disableClassPathURLCheck=true</argLine>
'other' has different root

Note that the error messages are right but the hinted argLine does not help.

Ekryd commented 6 months ago

Interesting, thanks for the PR! I'll get access to a windows computer next week and then I can have a look how this occurs.

mches commented 6 months ago

The ideas for what to try came from here

mches commented 6 months ago

This note makes surefire.useManifestOnlyJar=false sound like the preferable option.

Ekryd commented 5 months ago

Hi! I tried compiling master on two different drives but was not able to reproduce the original problem. I also read up a little on the link you sent me. It seems that this is setting could be used if you have specific problems with the build. The setting might give you other problems though (that is why it isn't set by default). I'm a bit hesitant to put this in at the moment. I'll keep the PR for the future, though. Thanks for the contribution!

mches commented 5 months ago

One of the interesting nuances of this error is that there is no indication in the console log and no interruption to the build. Thanks for checking into it. There are simple workarounds, so no worries.

Workarounds:

  1. Add -Dsurefire.useManifestOnlyJar=false as a Maven command-line argument, or add the same property to an active-by-default profile within settings.xml
  2. If the Git Repo is on the E: drive, add -Dmaven.repo.local=E:\.m2\repository as a command-line argument, or set <localRepository/> within settings.xml
    • When the Git repo and Maven local repo are on the same drive, the manifest-only JAR will have only relative paths