Closed streamingdv closed 4 months ago
Hi @streamingdv!
I planned to split some JP features into several Maven plugins and Gradle tasks, so you can combine them, e.g, you can call CreateAppTask
, run your stuff, and then call GenerateInstallerTask
. I think this could bring a lot of possibilities. JP internal logic is able to do this:
Anyway, I'll try to reproduce your issue and find a simple solution or a workaround.
If you want to do some research by yourself, take a look into this:
This is the snipet of code which copies dependencies in Gradle.
Hi again! I've managed to reproduce your issue:
C:\Users\fvarrui\GitHub\HelloWorldGradle>build\HelloWorldGradle\HelloWorldGradle.exe
Error occurred during initialization of boot layer
java.lang.module.FindException: Two versions of module javafx.graphics found in libs (javafx-graphics-22-win.jar and javafx-graphics-20.0.1-win.jar)
The problem is not about duplicated jars, but duplicated modules (javafx.graphics
module is twice) ... what if you call your custom javafx.graphics.jar
with the same name as the JAR which is being included by javafx-gradle-plugin
('javafx-graphics-22-win.jar
), so it'll be ovewriten with your custom JavaFX jar. I've just released a SNAPSHOT version with DuplicatesStrategy=EXCLUDE when copying libraries to avoid this error: 1.7.6-20240421.230018-6
... try it and give me some feedback, please.
Could not find io.github.fvarrui:javapackager:1.7.6-20240421.230018-6 Which maven repo should I include in my gradle script in order to use the snapshot?
New snapshot released: 1.7.6-20240423.010107-7
.
Now duplicatesStrategy=WARN
by default, but you can set a different duplicates strategy to your PackageTask
:
tasks.register('packageApplication', PackageTask) {
// mandatory
mainClass = 'com.grill.app.Launcher'
// optional
bundleJre = true
generateInstaller = true
administratorRequired = false
copyDependencies = true
[...]
duplicatesStrategy = DuplicatesStrategy.[EXCLUDE|FAIL|INCLUDE|INHERIT|WARN]
}
and this should work too:
tasks.configureEach {
if (it instanceof Copy || it instanceof Zip || it instanceof Tar || it instanceof PackageTask) {
it.duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
}
Thanks, it works now with the provided Snapshot. :) I hope this will make it into the next release.
Please, let's keep this issue open untill it's released
Branch issue-400
merged into devel
, ready to be released in 1.7.6
v1.7.6 released to Maven Central
I'm submitting a…
Short description of the issue/suggestion: I have a special setup where I include my own compiled 'javafx-graphics-22-win.jar' because I compiled it with enabling the OpenGL rendering pipeline. My own javafx graphics lib is called 'javafx.graphics..jar' which is in my libs folder of my project and it gets imported like this
implementation fileTree(include: ["*.jar"], dir: "libs")
This is my javapackager task
Because of this I have now dublicated graphics jar files in my generated libs folder of javapackager and I get following error when I try to start the application
So in order to mitigate this issue I have another task which deleted the other unwanted graphics jar
This works for the generated exe in the folder but is already too late for the installer, which means my installers will get generated with the additional graphics jar bundled. This leads to the same crash as mentioned above when executing my installed application on a PC (because it bundles the two graphics jar libs).
I tried to name the graphics jar the same as the original (
javafx-graphics-22-win.jar
) but this leads to following errorNot sure why I get this erros as I have defined these rules which are working in other tasks
Steps to reproduce the issue/enhancement:
What is the expected behavior?
Would be nice if there is a way to handle such a scenario in JavaPackager, but maybe there is or maybe there is a workaround for that? Maybe a hook to a task which allows you to do certain things before the installer gets created?
What is the current behavior?
I think there is no easy way to handle that scenario with javapackager but I might be wrong?
Please tell us about your environment: