apache / netbeans

Apache NetBeans
https://netbeans.apache.org/
Apache License 2.0
2.64k stars 849 forks source link

Use relative wrapper paths to prevent space-in-path bugs #7558

Closed sdedic closed 3 months ago

sdedic commented 3 months ago

The mvnw wrapper contains a subtle bug, which triggers when -running on UNIXes, and

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

sdedic commented 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.

sdedic commented 3 months ago

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.

neilcsmith-net commented 3 months ago

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!

MartinBalin commented 3 months ago

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

mbien commented 3 months ago

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.

sdedic commented 3 months ago

@mbien file a feature request for that pls... good idea !

mbien commented 2 months ago

@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