Closed sdedic closed 3 months ago
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.
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?
Pls. elaborate ... whta script should be used then ? I've tried to use mvn wrapper:wrapper
(maven 3.9.8) and still mvnw
in the project root seems to be the one.
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 new wrapper version that wget
-downloads the distribution works even with the original MavenCommandLineExecutor
and does not break with this PR.
Yes, the default script is now https://github.com/apache/maven-wrapper/blob/master/maven-wrapper-distribution/src/resources/only-mvnw since https://github.com/apache/maven-wrapper/pull/127 although still called mvnw
in the project.
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 wrapper:wrapper
if the user gives the OK. This would remove the need for workarounds and also help users to fix issues in their repos - that is what IDEs are for IMO.
@mbien file a feature request for that pls... good idea !
@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
mvnw
wrapper contains a subtle bug, which triggers when -running on UNIXes, and./mvnw
or../mvnw
from 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).