Skip to content
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

Add support for -X JVM options #1068

Closed
wants to merge 1 commit into from
Closed

Conversation

malliina
Copy link

If you specify JVM options starting with "-X" in javaOptions in Universal, such as

-Xbootclasspath/p:/usr/share/appname/lib/org.mortbay.jetty.alpn.alpn-boot-8.1.11.v20170118.jar

Then the bash script will append the option too late in the java command, and it won't work. This commit fixes it. Similar to #431.

@muuki88
Copy link
Contributor

muuki88 commented Nov 17, 2017

Thanks for your pull request.

IIRC you can append JVM parameters by starting with -J, e.g. -J-Xmx512mb. If this is not working for you then we should open a bug to fix this.

@malliina
Copy link
Author

malliina commented Nov 18, 2017

Thanks for the suggestion, I tried prepending -J, however it didn't work. I believe in this case the example -X parameter above needs to be treated like app parameters similar to -D params.

What does work is the following:

bashScriptExtraDefines += s"""addJava "-Xbootclasspath/p:/usr/share/app/lib/file.jar""""

I interpreted from the docs that an equivalent way to define that is:

javaOptions in Universal += "-Xbootclasspath/p:/usr/share/app/lib/file.jar"

or then

javaOptions in Universal += "-J-Xbootclasspath/p:/usr/share/app/lib/file.jar"

However, neither of the javaOptions ... approaches work in this case (but maybe the -J params do work for JVM memory settings). Effectively the desired java run command would look like:

java -Xbootclasspath/p:/usr/share/appname/lib/file.jar -Dexample.prop=example.value -Dother=values and so on...

And that's only the case for me if I add the parameter using bashScriptExtraDefines above. Well, since the bashScriptExtraDefines approach works for me I'll survive, but I thought this was quite confusing to configure as it is.

@dwickern
Copy link
Collaborator

Looking at the code, -J-X should be equivalent to addJava -X 🤔

@malliina
Copy link
Author

Yeah you are correct, sorry for wasting your time with this PR. I had a problem in my deployment process where changes to JVM parameters didn't propagate properly in all cases.

@malliina malliina closed this Nov 18, 2017
@muuki88
Copy link
Contributor

muuki88 commented Nov 18, 2017

No worries ☺️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants