TheBoegl / gradle-launch4j

A gradle-plugin to create windows executables with launch4j
Apache License 2.0
311 stars 42 forks source link

Is it possible to use gradle-launch4j with XML configuration #32

Closed radistao closed 7 years ago

radistao commented 8 years ago

I have my legacy project which builds exe using command line in Windows like here described in the docs: launch4jc buldConf/launch4j-config.xml

Now i'd like to use gradle-launch4j plugin instead. Could i reuse existent XML settings file, instead of setting all those properties manually?

As i understood, xmlFileName is just an output name for generateXmlConfig task.

Thanks

TheBoegl commented 8 years ago

@radistao If you do not want the launch4j plugin to configure your launch4j configuration you could just create a gradle task to run the launch4jc command from above.

radistao commented 8 years ago

but how to run launch4jc from the plugin? or you mean start system installed launch4jc using exec gradle task?

TheBoegl commented 8 years ago

The plugin is not designed that way because a user usually wants to use some other parts of the gradle script within the launch4j plugin, e.g. the version. If you do not want to change the configuration what would you use the launch4j plugin for? You could try to move your configuration file in doFirst() to a backup and move them back in doLast() but it could be, that this won't work. I think it is much easier to either call the system installed launch4jc or use this plugin as it was designed to be used for.

TheBoegl commented 7 years ago

With the internal restructure we should be able to allow this use case, hence, I reopen this issue.

radistao commented 7 years ago

hm, sounds sweet. do you need some help (not sure so far i can do something, but at least can try :) )

TheBoegl commented 7 years ago

Thanks, but I hope to find time this week to finish the rework and testing.

TheBoegl commented 7 years ago

@radistao Please check if the branch issue/32 addresses your issue correctly. I find this to confusing, but maybe you could explain why you want to use it that way or what way you are after, after all...

radistao commented 7 years ago

@TheBoegl thanks a lot for your work, but i'm still also confused are we on the same page.

My question was about this:

i have JavaFx project. To build windows .exe file i make the next steps:

  1. Build fat jar using shadow gradle plugin.
  2. Install launch4j application in Windows.
  3. Create settings file like this XML file
  4. Run command line
    launch4jc launch4j.xml

    at the end i've got my MyAppName.exe

I thought it is possible to avoid installation launch4j application and build the .exe using your plugin. Is it possible? And i need to use all those properties from that XML file.

Thanks for your concern!!

TheBoegl commented 7 years ago

@radistao I think I understood you in the first place, though not why you want to do it that complicated. Now I do... The plugin downloads launch4j on its own and calls it to generate the executable. Your task is to translate the xml file you attached to the launch4j configuration and call the createExe task. The README.md should help with the default values. If you need further help let me know.

TheBoegl commented 7 years ago

I'm closing this as a question. If you need further assistance let me know.

radistao commented 7 years ago

Sorry, Sebastian - still haven't have a time to test (( I'll let you know as soon as i tested it. Thanks for your concern.

alexanderfloh commented 7 years ago

@TheBoegl I've encountered a similar issue as @radistao and tried the fix for this issue and it works as expected. Can you please merge it to the main branch and release it?

Thank you for putting so much effort in this!

TheBoegl commented 7 years ago

@alexanderfloh could you provide a use case for managing the xml on your own and just call the external task? I'm not satisfied with the current implementation of the issue branch, because it fails to often if one of the 'dependencies' in the xml is not really met in the application.

alexanderfloh commented 7 years ago

My scenario is that I have a very large project with multiple sub-modules. Some of those sub-modules should then be used for the classpath of the .exe.

Ideally, I'd like to be able to specify the classpath part of the launch4j configuration manually rather than having all sub-modules in the classpath (default case) or have them copied around a lot (specifying copyConfigurable).

In my case, manually maintaining the classpath in the launch4j.xml, putting the file in version control and using it for building the .exe seems like a reasonable work-around.

TheBoegl commented 7 years ago

Would you allow me to peek a look at that project?

alexanderfloh commented 7 years ago

No sorry, it's closed source and not my decision to make.

I can probably give you more context if that would help. Is there anything specific you'd like to know?