Jorl17 / jar2app

Convert any Java jar to a Mac OS X .App bundle. No external tools needed, no funky parameters, it just works.
GNU General Public License v2.0
414 stars 56 forks source link

Add additional dependencies #37

Open Darrel12 opened 5 years ago

Darrel12 commented 5 years ago

Looking at How to package extra files into app I see that the solution was to manually copy the desired file into the Contents directory. I would like to propose an additional terminal option to add a library folder.

Ex: jar2app XXXX.jar --additional-libs=/path/to/library/

The reason being is that there are occasionally JARs that have an external lib folder that is required for the JAR's execution such as MSGViewer. It makes sense to have it packaged along with it as a standard approach instead of extra steps seeing as it's necessary for core operation rather than an extraneous bit of data to be used by the JAR.

If you like the idea, I'll try to find some spare time to fork this repo and add it in myself.

Edit: Since this is for libraries/files to be used as dependencies for the JAR being added and the JAR usually looks in the CWD, the additions would go in the XXXX.app/Contents/Java/ folder rather than simply XXXX.app/Contents/ as it was done in the aforementioned issue.

Lucina commented 5 years ago

Would you think naming the terminal option --additional-files would be more appropriate? Passing a semicolon-delimited list of files and folders to copy over is what I was thinking.

Darrel12 commented 5 years ago

I agree, that naming convention sounds better. Semicolon-delimited is a perfect option for multiple additions. I updated the OP to specify that the additions are going into the Java folder of Contents since my primary concern is for the JAR's dependencies. How does that sound to you?

I was thinking there could be an additional comma-delimited sub-parameter within each semicolon-delimited item to specify the subfolder that the file should go into. Or perhaps a 1:1 mapping from --additional-files to an optional specification, something like --additional-files-dir if the user wants to specify the directory for the respective addition's desired location.

I'm thinking in terms of automated build environments, but it does introduce more complexity. Do you think it is a good idea, or just stick with --additional-files and keep it to the XXXX.app/Contents/Java folder?

Lucina commented 5 years ago

The two use cases I can see are dependency jars and resources loaded from plain files. --additional-files for resources > Contents and --additional-jars for jars > Contents/Java, perhaps. Both with support for sub-parameters, and essentially the same except for the destination. I think that should suffice.

Darrel12 commented 5 years ago

I like that since my libs are all jars so --additional-jars sounds like a good choice. I'll try to find some time in the next few days or perhaps this weekend to get started. Thanks.

Darrel12 commented 5 years ago

https://github.com/Jorl17/jar2app/pull/38