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

Provide a way for Drombler FX support #274

Open
FibreFoX opened this issue Feb 7, 2017 · 14 comments
Open

Provide a way for Drombler FX support #274

FibreFoX opened this issue Feb 7, 2017 · 14 comments

Comments

@FibreFoX
Copy link
Member

FibreFoX commented Feb 7, 2017

The javafx-maven-plugin as a wrapper for the javapackager does not provide a nice way to integrate with the DromblerFX framework written by @puce77 .

This is meant to be a discussion-thread about what requirements are needed for full integration.

@puce77 Please list the steps you require for your workflow, maybe we can find a way where I can give you a more direct access to the internals, instead of combining too much.

@FibreFoX
Copy link
Member Author

FibreFoX commented Feb 7, 2017

Copied from #259 (comment)

I understand that the JavaFX Maven Plugin is basically a wrapper for the javapacker tool.

But the plugin does several things:

    it creates a JAR file
    it copies dependencies/ calculates the Manifest Class-Path from a lib directory
    it copies additional resources
    it creates native packages
    it runs the application
    ...

It's an assumption of the plugin that everything is located in the same directory, not an assumption of the javapacker tool, AFAIK.

All I'm asking is for a possibilty to configure the plugin so that the JAR file and the lib directory are located in a sub-directory of the app directory (which is used by the additional resource copy and the native packagers).

Maybe "binDir" was a bad name and too Drombler FX specific.
Maybe something like "jarParentFolderName"?

E.g. with the following configuration:
jfxAppOutputDir = ${project.build.directory}/jfx/app (default)
jarParentFolderName = a1/a2 (default "" or ".")
libFolderName = b1/b2 (default "lib")

The jar should be created at: ${project.build.directory}/jfx/app/a1/a2
The dependencies should be copied to: ${project.build.directory}/jfx/app/a1/a2/b1/b2
The Manifest Class-Path entries should start with: b1/b2/
The additional resources should be copied to: ${project.build.directory}/jfx/app
The native packager should work on: ${project.build.directory}/jfx/app

To support only a single level for jarParentFolderName and libFolderName would also be enough at least for my use case and might be easier to implement.

I already tried your proposal to set jfxAppOutputDir to ${project.build.directory}/jfx/app/bin before my initial binDir proposal but I soon realized that things will get quickly messy when the meaning of jfxAppOutputDir changed during one build. It would be messy for the Drombler FX Maven Plugin and very difficult for developers to tweak the two plugins for their needs.

So I really need some kind of configuration possibility here.

@FibreFoX
Copy link
Member Author

FibreFoX commented Feb 8, 2017

@puce77 I have checked the installers a bit, and it seems that not onl the javafx-maven-plugin needs that kind of tweaking. Have a look at this:

[Files]
Source: "APPLICATION_NAME\APPLICATION_NAME.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "APPLICATION_NAME\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs

[Icons]
Name: "{group}\APPLICATION_NAME"; Filename: "{app}\APPLICATION_NAME.exe"; IconFilename: "{app}\APPLICATION_NAME.ico"; Check: APPLICATION_MENU_SHORTCUT()
Name: "{commondesktop}\APPLICATION_NAME"; Filename: "{app}\APPLICATION_NAME.exe";  IconFilename: "{app}\APPLICATION_NAME.ico"; Check: APPLICATION_DESKTOP_SHORTCUT()
SECONDARY_LAUNCHERS

This is the content of the used .iss-file, which shows that the javapackager itself is expecting to have the native launcher and anything else in the same folder, not that structured as you wishes. Creating the content of the app-folder might work with something like "parent folder", but the installer would have to be modified as well.

Do you want to create INSTALLERS or just a bundle which you can ZIP up?

@FibreFoX FibreFoX mentioned this issue Feb 8, 2017
@FibreFoX
Copy link
Member Author

FibreFoX commented Feb 8, 2017

One thing closed my mind: how do you think about your own custom bundlers which generate JAR-files and installers like you wish? Instead of modifying the existing bundlers, especially the installers, it might make more sense to create an own custom bundler which generates everything as you wish

@puce77
Copy link
Contributor

puce77 commented Feb 9, 2017

First here my current requirements (jfx = JavaFX Maven Plugin):
The application layout currently looks like this:
standalone/bin/my-app.jar (new: should be created by jfx)
standalone/bin/lib/ (new ; copied by Drombler FX ; jfx may add additional lib e.g. packager.jar)
standalone/bundle (copied by Drombler FX from the runtime dependencies ; loaded dynamically at runtime)
standalone/conf (new: copied by jfx from additionalAppResources)

This already works using the following branches:
https://github.com/Drombler/javafx-maven-plugin/tree/classpath-libs
https://github.com/Drombler/drombler-fx/tree/137-packaging-support
but not with
https://github.com/javafx-maven-plugin/javafx-maven-plugin/tree/master

Currently I need to support native installers for all platforms supported by javapacker and likely also a ZIP-file distribution in addition.

https://github.com/Drombler/javafx-maven-plugin/tree/native (work in progress)

I can create a deb and rpm file on Kubuntu 16.04.1 LTS.
I could install the deb file but when executing the binary on a console I get:

Exception in Application init method
my-app Error invoking method.
my-app Failed to launch JVM

Later support for preloader, JNLP etc. might be added.

In the coming days I will describe how the current solution works and then we can discuss how to go forward from there.

@puce77
Copy link
Contributor

puce77 commented Feb 9, 2017

I'm not sure what you mean with "custom bundlers". Wouldn't that mean I would have to create "generators" for types (deb, rpm, exe, msi, ...) myself? If yes, I'm afraid this is currently not really an option. If I misunderstood something, please explain.

@FibreFoX
Copy link
Member Author

FibreFoX commented Feb 9, 2017

"Custom Bundlers" are a way to extend "AbstractBundler" and implement your own way of bundling, while still using the javafx-maven-plugin, but as you are requiring deb/rpm/pkg/.... this is not an option right now.

About the JVM-error and layout-thing:
As commented above (#274 (comment)), you will not only require to adjust the installer-files, the native launcher-files are expecting their files in a special directory-layout, this is nothing I can configure.

The native launchers are expecting their java-files in the app-folder, mostly the .cfg-files where the bootstrapping starts. Requesting a different file-layout is not compatible with the current native files provided with the JDK. If you want to change this, you are required to provided your own launcher-binaries :(

@puce77
Copy link
Contributor

puce77 commented Feb 16, 2017

Using the following branches a Drombler FX application can be packaged (deb), installed and run:
https://github.com/Drombler/javafx-maven-plugin/tree/native
https://github.com/Drombler/drombler-fx/tree/137-packaging-support

The layout of the application is not optimal, but at least the content of the app directory is more or less as expected and like a ZIP distribution would look like.

@puce77
Copy link
Contributor

puce77 commented Feb 16, 2017

The current solution looks like this:

                   <initialize>
                        org.drombler.fx:drombler-fx-maven-plugin:create-standalone-dir,
                        org.drombler.fx:drombler-fx-maven-plugin:set-maven-properties
                    </initialize>
                    <generate-resources>org.drombler.fx:drombler-fx-maven-plugin:generate-application-resources</generate-resources>
                    <process-resources>
                        org.apache.maven.plugins:maven-resources-plugin:resources
                    </process-resources>
                    <compile>org.apache.maven.plugins:maven-compiler-plugin:compile</compile>
                    <process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources</process-test-resources>
                    <test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile>
                    <test>org.apache.maven.plugins:maven-surefire-plugin:test</test>
                    <prepare-package>
                        org.drombler.fx:drombler-fx-maven-plugin:copy-standalone-startup-libs,
                        org.drombler.fx:drombler-fx-maven-plugin:copy-standalone-bundles
                    </prepare-package>
                    <package>
                        org.apache.maven.plugins:maven-jar-plugin:jar,
                        com.zenjava:javafx-maven-plugin:build-jar,
                        org.drombler.fx:drombler-fx-maven-plugin:ensure-standalone-config
                    </package>
                    <install>
                        org.apache.maven.plugins:maven-install-plugin:install
                    </install>
                    <deploy>
                        org.apache.maven.plugins:maven-deploy-plugin:deploy
                    </deploy>

@puce77
Copy link
Contributor

puce77 commented Feb 16, 2017

The set-maven-properties goal sets the following JavaFX Maven Plugin properties:

'jfx.mainClass' = 'org.drombler.fx.startup.main.DromblerFXApplication'
'jfx.jfxMainAppJarName' = '${dromblerfx.brandingId}.jar'
'jfx.jfxAppOutputDir' = '${project.build.directory}/deployment/standalone'
'jfx.nativeOutputDir' = '${project.build.directory}/deployment/native'
'jfx.jfxBinDir' = 'bin'
'jfx.jfxLibDir' = 'lib'
'jfx.updateExistingJar' = 'true'
'jfx.skipCopyDependenciesToLibDir' = 'true'
'jfx.additionalAppResources' = '${project.basedir}/src/main/app'
'jfx.copyAdditionalAppResourcesToJar' = 'true'
'jfx.identifier' = '${project.groupId}.${dromblerfx.brandingId}'
'jfx.nativeReleaseVersion' = '${project.version}'
'jfx.appName' = '${dromblerfx.title}'
'jfx.appFsName' = '${dromblerfx.brandingId}'

@puce77
Copy link
Contributor

puce77 commented Feb 18, 2017

@FibreFoX As you see the Proof of Concept is already working but it requires something like "jfx.jfxBinDir" or "jfx.jarParentFolderName" or similar.

@FibreFoX
Copy link
Member Author

Does it work cross-os? with all installers?

@puce77
Copy link
Contributor

puce77 commented Feb 18, 2017

I haven't tried yet to run it on a different OS. Do you see any bigger issues that could come up on other OS using this approach?

@FibreFoX
Copy link
Member Author

#274 (comment)
Thats one of the parts I am worried about ... the installer-scripts are very picky about paths ...

@puce77
Copy link
Contributor

puce77 commented Feb 18, 2017

Thanks for the hint. I will check it in the coming days.

@FibreFoX FibreFoX added this to the v9.0.0 milestone Aug 15, 2017
@FibreFoX FibreFoX removed this from the v9.0.0 milestone Mar 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants