tschulte/gradle-jnlp-plugin

Allow specifying arbitrary <property>s under <resources>

amake opened this issue · 2 comments

amake commented

(Apologies if this is already possible; if it is, I couldn't figure it out.)

It would be useful to be able to specify additional <property name="foo" value="bar"/> elements for the <resources> block. For instance in an app I am working on porting to Gradle we specify

<property name="javaws.cfg.jauthenticator" value="true" />

to work around an overzealous HTTP authentication dialog that javaws offers by default (for historical reasons, settings this to true turns it off 🙄).

Currently it seems there is no way to add to the <resources> block automatically written by the plugin; specifying another resources in withXml results in a second <resources> block.

Currently, withXml is the only way to do that. Yes, that results in a second <resources> block, but I have never had any issues with this. We are doing exactly that is our application at work to set arbitrary system properties. Our resulting jnlp looks like this:

<?xml version='1.0' encoding='UTF-8'?>
<jnlp spec='7.0' href='http://...' version='...' codebase='http://...'>
  ...
  <resources>
    <property name='jnlp.codebase' value='http://...' />
    <property name='jnlp.orgunit' value='KAM' />
  </resources>
  <resources os='Windows'>
    <property name='jnlp.launch.jnlp' value='http://...' />
  </resources>
  <resources>
    <j2se version='1.8+' java-vm-args='-Xmx256m' />
    <jar href='lib/main.jar' version='...' main='true' />
    ...
  </resources>
  <application-desc main-class='kam.rocky.janet.base.JanetMain' />
</jnlp>
amake commented

OK, thanks! I have to admit I didn't test multiple <resources> blocks because the app is cumbersome to deploy, but if it works then it works.