Use relative wrapper paths to prevent space-in-path bugs#7558
Conversation
neilcsmith-net
left a comment
There was a problem hiding this comment.
Makes sense!
The script you point to is no longer even the default wrapper script. Have you checked before and after with the only-script variant too?
|
Re.: motivation for this PR - both Micronaut Launcher and GDK Launcher (Oracle's work) use an older mvnw to generate the projects, this PR allows NB to work well with those generated projects.
Pls. elaborate ... whta script should be used then ? I've tried to use So if this fix is partial, but working, I'd prefer to merge, and work on an improvement. |
|
Ah, I understood after looking into the wrapper ;) |
|
Yes, the default script is now https://github.com/apache/maven-wrapper/blob/master/maven-wrapper-distribution/src/resources/only-mvnw since apache/maven-wrapper#127 although still called Thanks for checking! |
|
Micronaut developer explained me that they tried new maven wrapper in June and it caused them some serious side effects and issues in eg guides generation. So they rolled back to older version... |
|
thanks for fixing this. I is just a bit of a shame that workarounds like this one here will have to stick around for a very long time. I think it would be better if IDEs would detect problematic wrapper scripts, notify the user and run |
|
@mbien file a feature request for that pls... good idea ! |
@sdedic I haven't forgotten about this, i wanted to bring this to the mailing list later between releases, but the recent discussions accelerated it a bit, so I wrote it down right away: https://lists.apache.org/thread/lgfvt0649rlg83j46bcczxj30y87qh95 |
The
mvnwwrapper contains a subtle bug, which triggers when-running on UNIXes, and
In that case, the wrapper fails to locate its basedir and loops indefinitely, not even launching Maven itself. Regular user just uses
./mvnwor../mvnwfrom the terminal, and is not affected. Sadly NB uses full path to invoke the wrapper.The bug was fixed an year ago in maven-wrapper, line 173 but since the wrapper script is committed in many git repositores, NB should work well even with the buggy version.
This PR relativizes the wrapper path to the execution directoy (either the project dir, or the reactor dir) which works around this bug: one would have to have spaces in path to maven module within the project, which is quite unlikely (and such project would not be usable even from the commandline).