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

Can't create dmg package on macOS using Kotlin #98

Closed
adam-arold opened this issue Jan 10, 2018 · 11 comments
Closed

Can't create dmg package on macOS using Kotlin #98

adam-arold opened this issue Jan 10, 2018 · 11 comments

Comments

@adam-arold
Copy link

adam-arold commented Jan 10, 2018

I'm trying to build a dmg package from my JavaFx project (which contains a single button ATM).

My configuration is the following:

jfx {
	mainClass = 'com.example.test.MainKt'
	vendor = 'test'
	verbose = true
        appName = "test"
        alternativePathToJarFile = "build/libs/test.jar"
        bundler = "dmg"
}

This is the output of running gradle jfxNative:

Task :jfxNative
Building DMG package for test
"Adding modules: [java.rmi, java.sql, javafx.web, jdk.charsets, java.logging, java.xml.crypto, java.xml, jdk.xml.dom, jdk.jfr, java.datatransfer, jdk.packager.services, jdk.httpserver, javafx.base, jdk.net, java.desktop, java.naming, javafx.controls, java.prefs, java.security.sasl, jdk.naming.rmi, jdk.zipfs, java.base, jdk.crypto.ec, jdk.management.agent, java.management, java.sql.rowset, javafx.swing, jdk.jsobject, jdk.sctp, java.smartcardio, jdk.unsupported, jdk.jdwp.agent, jdk.scripting.nashorn, java.instrument, java.security.jgss, jdk.management, java.compiler, javafx.graphics, jdk.security.auth, java.scripting, javafx.fxml, jdk.dynalink, javafx.media, jdk.accessibility, java.management.rmi, jdk.naming.dns, jdk.security.jgss, jdk.localedata] to runtime image."
outputDir = /var/folders/sg/z29vgx592s78q564nytqyd880000gn/T/fxbundler17757865355289544977/images/image-9350623328558951349/test.app/Contents/PlugIns/Java.runtime/Contents/Home
modulePath = [/Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home/jmods]
addModules = [java.rmi, java.sql, javafx.web, jdk.charsets, java.logging, java.xml.crypto, java.xml, jdk.xml.dom, jdk.jfr, java.datatransfer, jdk.packager.services, jdk.httpserver, javafx.base, jdk.net, java.desktop, java.naming, javafx.controls, java.prefs, java.security.sasl, jdk.naming.rmi, jdk.zipfs, java.base, jdk.crypto.ec, jdk.management.agent, java.management, java.sql.rowset, javafx.swing, jdk.jsobject, jdk.sctp, java.smartcardio, jdk.unsupported, jdk.jdwp.agent, jdk.scripting.nashorn, java.instrument, java.security.jgss, jdk.management, java.compiler, javafx.graphics, jdk.security.auth, java.scripting, javafx.fxml, jdk.dynalink, javafx.media, jdk.accessibility, java.management.rmi, jdk.naming.dns, jdk.security.jgss, jdk.localedata]
limitModules = []
excludeFileList = .*\.diz
stripNativeCommands = true
userArguments = {}
java.nio.file.NoSuchFileException: /var/folders/sg/z29vgx592s78q564nytqyd880000gn/T/fxbundler17757865355289544977/images/image-9350623328558951349/test.app/Contents/Java/lib/kotlin-stdlib-jre7-1.2.10.jar
java.nio.file.NoSuchFileException: /var/folders/sg/z29vgx592s78q564nytqyd880000gn/T/fxbundler17757865355289544977/images/image-9350623328558951349/test.app/Contents/Java/lib/kotlin-stdlib-jre7-1.2.10.jar
        at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
        at java.base/sun.nio.fs.UnixCopyFile.copyFile(UnixCopyFile.java:248)
        at java.base/sun.nio.fs.UnixCopyFile.copy(UnixCopyFile.java:586)
        at java.base/sun.nio.fs.UnixFileSystemProvider.copy(UnixFileSystemProvider.java:254)
        at java.base/java.nio.file.Files.copy(Files.java:1287)
        at jdk.packager/jdk.packager.builders.mac.MacAppImageBuilder.copyClassPathEntries(MacAppImageBuilder.java:457)
        at jdk.packager/jdk.packager.builders.mac.MacAppImageBuilder.prepareApplicationFiles(MacAppImageBuilder.java:387)
        at jdk.packager/jdk.packager.internal.JLinkBundlerHelper.execute(JLinkBundlerHelper.java:352)
        at jdk.packager/com.oracle.tools.packager.mac.MacAppBundler.doBundle(MacAppBundler.java:359)
        at jdk.packager/com.oracle.tools.packager.mac.MacBaseInstallerBundler.prepareAppBundle(MacBaseInstallerBundler.java:211)
        at jdk.packager/com.oracle.tools.packager.mac.MacDmgBundler.bundle(MacDmgBundler.java:85)
        at jdk.packager/com.oracle.tools.packager.mac.MacDmgBundler.execute(MacDmgBundler.java:549)
        at de.dynamicfiles.projects.gradle.plugins.javafx.tasks.workers.JfxNativeWorker.jfxnative(JfxNativeWorker.java:348)
        at de.dynamicfiles.projects.gradle.plugins.javafx.tasks.JfxNativeTask.jfxnative(JfxNativeTask.java:32)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:46)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:780)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:747)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
        at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
        at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
        at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
        at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
        at java.base/java.lang.Thread.run(Thread.java:844)
Config files are saved to /var/folders/sg/z29vgx592s78q564nytqyd880000gn/T/fxbundler17757865355289544977/macosx. Use them to customize package.


BUILD SUCCESSFUL in 15s
4 actionable tasks: 2 executed, 2 up-to-date

My observations:

  • I use the gradle shadow plugin to create an uberjar. I set up your plugin to use this file with alternativePathToJarFile (in theory).
  • The kotlin runtime is bundled into this file:
dependencies {
	shadow("org.jetbrains.kotlin:kotlin-stdlib-jre8")
	shadow("org.jetbrains.kotlin:kotlin-reflect")
        shadow("no.tornado:tornadofx:1.7.14")
}
  • If I check the contents of my jar it is OK.
  • Why is this the output dir? /var/folders/sg/z29vgx592s78q564nytqyd880000gn/T/fxbundler17757865355289544977/images/image-9350623328558951349/test.app/Contents/PlugIns/Java.runtime/Contents/Home
  • Why is it looking for kotlin-stdlib-jre7-1.2.10.jar? I don't use jre7.

If I go to the build/jfx dir after running jfxNative I can see an app dir which contains a project-jfx.jar but this file does not have the dependencies which I have added with shadow to the jar file which I supplied as a parameter with alternativePathToJarFile. What is the reason for this?
The native folder is empty and there is no .dmg file.

What am I doing wrong?

@FibreFoX
Copy link
Owner

you should check your dependencies, and btw: this plugin isn't JDK9 compatible yet

@adam-arold
Copy link
Author

I'll try it with JDK8 then.

@FibreFoX
Copy link
Owner

FibreFoX commented Jan 21, 2018

@adam-arold any progress? meanwhile you want to try 8.9.0-SNAPSHOT, as it is having proper JDK 9 compatibility (please see #57 (comment) for more information)

EDIT: maybe this is something related to the way how the "maven"-shadowing process is working in gradle....

@adam-arold
Copy link
Author

No progress yet, I started working on something else but I'll come back to this soon.

@FibreFoX
Copy link
Owner

ping @adam-arold
you might want to try with some snapshot-version for JDK9 compatibility #57 (comment)

@marco-primiceri
Copy link

Hi @adam-arold, just FYI, I was able to create a dmg package using Kotlin.
Current setup:

  • javafx-gradle-plugin:8.8.0
  • kotlin:1.2.21
  • java:1.8.0_162

PS: Have you tried wiping out your system temp folders? I had a similar problem whereby it got stuck with a failing configuration and javapackager kept using the same broken temp folder.

@adam-arold
Copy link
Author

Hi @marco-primiceri, can you share your code in a gist?

@marco-primiceri
Copy link

Sure @adam-arold ( you meant the gradle code right?) here it is:
https://gist.github.com/marco-primiceri/9ea0692e1baf7fb6a3ec64730b61ebf2

@adam-arold
Copy link
Author

Great thanks! I'll try this out next week!

@FibreFoX
Copy link
Owner

To sum up: I suspect the way of the shadow-plugin is in conflict here, it's nothing regarding the kotlin-plugin itself, because this gradle-plugin works on the generated jar-file. Please consider to NOT use some uber-jar, because there is no need to put everything into one file when dealing with application-bundles.

@adam-arold Please give some feedback if you got the time to check. I'm back on my "every day a bit for the javafx-*-plugin-projects"-work, so I intend to close some issues the next days.

@marco-primiceri thanks for your valuable feedback, thinking about this project being used by a lot of people makes me very happy (especially when realizing, that it seems that I filled some gap for the devs)

@marco-primiceri
Copy link

Well, thanks to you Danny, your plugin is awesome!
And yes, you are correct, it does fill a gap for people like me who rely on gradle (and cannot be bothered to use ant for packaging :).

Cheers,
Marco

@FibreFoX FibreFoX closed this as completed Dec 8, 2019
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

3 participants