badass-runtime-plugin
badass-runtime-plugin copied to clipboard
How to generate for Mac and Windows ? (Error)
Greetings. I normally generate with jpackage for windows only. But now I need to generate for MAC. I downloaded the MAC jmods and MAC javafx sdk from gluon and pointed them at the build.gradle. However, when I use 'targetPlatform("win"), I get the following error: Caused by: org.gradle.api.GradleException: Directory not found: /jmods
Here's my build.gradle (partially):
mainClassName = 'Main'
repositories { mavenCentral() }
javafx { version = "11.0.2" modules = [ 'javafx.swing', 'javafx.controls', 'javafx.fxml', 'javafx.web' ] }
run {
jvmArgs =
[ '--add-exports=javafx.base/com.sun.javafx.event=ALL-UNNAMED',
'--add-exports=javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED',
'--add-exports=javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED',
'--add-exports=javafx.base/com.sun.javafx.binding=ALL-UNNAMED',
'--add-exports=javafx.graphics/com.sun.javafx.stage=ALL-UNNAMED',
'--add-exports=javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED'
]
}
mainClassName = 'Main'
application { mainClassName = "Main" applicationName = 'artfx' }
//Dont change this project.version = "2.0.0"
runtime { options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
//Dont change this
additive = true
modules = ['javafx.swing','javafx.controls','javafx.fxml','javafx.web','jdk.localedata']
launcher{
jvmArgs = ['-Duser.language=pt', '-Duser.country=BR','-Duser.timezone="\\\\"America/Sao_Paulo"\\\\"']
}
//JMods 11 and javafx 11 SDK
targetPlatform("mac") {
jdkHome = 'C:/Program Files/Java/MAC/'
}
targetPlatform("win") {
jdkHome = 'C:/Program Files/Java/jdk-11.0.2/'
}
jpackage {
jpackageHome = 'C:/Program Files/Java/jdk-14.0.2/'
// targetPlatform("mac"){
//
// }
//Error: Caused by: org.gradle.api.GradleException: Directory not found: /jmods
targetPlatform("win") {
imageName = 'redacted'
imageOptions = ['--icon', 'src/main/resources/images/logo.ico']
installerOptions =
[
'--app-version','2.0.6',
'--win-per-user-install',
'--win-dir-chooser',
'--win-menu',
'--win-shortcut',
'--verbose',
'--description','redacted',
'--name', 'redacted',
'--vendor','redacted',
'--win-upgrade-uuid','redacted'
]
installerType = 'exe'
installerName= 'redacted.exe'
}
}
}
You can use jlink to generate images for other platforms (these are the artifacts created by the runtime
task in the build/images directory), but you cannot use jpackage to produce installers for other platforms. I updated the documentation to reflect this fact.