-
-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[packagers] Broken java-archive launcher in windows #1634
Comments
There is a good info in this old scala issue scala/bug#4858. They also had issues with quotes. |
We'd very much welcome a PR, thank you 😅 |
FWIW I think this could be fixed by using mustache itself, like so
|
That was something what I was thinking as well. However if you read that scala issue quoting is problematic itself if it'd done blindly as it breaks if existing JAVA_OPTS itself contain quotes. That's what I was planning to experiment that when this expansion actually blows up. |
AFAICT package processors should ensure the value of JAVA_OPTS is properly quoted before sending it to the Mustache template engine. |
Actually there's additional issues for quoting This was in my origin comment but I didn't pay attention(three quotes where one after jars messes things up):
I didn't realise this with |
For JAVA_OPTS I think we need to remove quoting as it will always break things up if there's more than one option(or one option with extra space).
If we want to be pedantic:
As bat interpreter doesn't remove quotes when using
you can use quotes but those needs to immediately surround options like:
And this same story goes with |
I see. Individual elements may need to be quoted but not the full set as a whole (all entries seen as a single argument). |
- This commit fixes various errors in windows launcher templates for java-archive and jlink. - JAVA_OPTS as whole cannot be surrounded with quotes as windows shell would then treat that as single argument and jvm blows up. Quotes could be used with individual JAVA_OPTS arguments but that is then solely left to user. - If java options are coming from distribution settings(ie jreleaser.yml) then we simply append to JAVA_OPTS as is without quoting. - In java-archive template java.exe is changed to backslash like it already was in jlink template. - Running java command also contained mixed double quoting and is fixed by removing quotes from JAVACMD. - Classpath contained mixed triple quoting and is fixed by removing quotes from JARSDIRS and CLASSPATH Fixes jreleaser#1634
- This commit fixes various errors in windows launcher templates for java-archive and jlink. - JAVA_OPTS as whole cannot be surrounded with quotes as windows shell would then treat that as single argument and jvm blows up. Quotes could be used with individual JAVA_OPTS arguments but that is then solely left to user. - If java options are coming from distribution settings(ie jreleaser.yml) then we simply append to JAVA_OPTS as is without quoting. - In java-archive template java.exe is changed to backslash like it already was in jlink template. - Running java command also contained mixed double quoting and is fixed by removing quotes from JAVACMD. - Classpath contained mixed triple quoting and is fixed by removing quotes from JARSDIRS and CLASSPATH Fixes #1634
🎉 This issue has been resolved in |
Originally in spring-projects/spring-cli#178 but noticed same issue in jreleaser as well.
spring-cli
is using fatjar while jreleaser uses exploded jar but both ways fail with:Problem is in
jreleaser/core/jreleaser-templates/src/main/resources/META-INF/jreleaser/templates/java-archive/java-archive/bin/launcher.bat.tpl
Line 57 in 5ba315d
I took jreleaser-standalone-early-access-windows-x86_64.zip and enabled "echo" in bat file:
In
spring-cli
it looks like:You get same error in java by just doing:
I could try to PR a fix?
The text was updated successfully, but these errors were encountered: