beryx-gist / badass-runtime-example-javafx

A small JavaFX application that shows how to use the Badass Runtime Plugin
Apache License 2.0
25 stars 3 forks source link

This plugin works only with non-modular applications. #32

Closed ghost closed 3 years ago

ghost commented 3 years ago

module-info.java

open module org.example.hellofx {

requires javafx.controls;
requires javafx.fxml;
requires org.beryx.runtime;

exports org.example.hellofx;

}

Build.gradle

plugins {
id 'application'
id 'org.openjfx.javafxplugin' version '0.0.9'
id 'org.beryx.runtime' version '1.11.3'
}

repositories {
mavenCentral()
}

javafx {
modules = ['javafx.controls', 'javafx.fxml']
}

application {
mainClassName = "org.example.hellofx.Launcher"
applicationName = 'hellofx'
}

runtime {
 options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
 launcher {
     noConsole = true
 }
 jpackage {
     def currentOs = org.gradle.internal.os.OperatingSystem.current()
     def imgType = currentOs.windows ? 'ico' : currentOs.macOsX ? 'icns' : 'png'
     imageOptions += ['--icon', "src/main/resources/hellofx.$imgType"]
     installerOptions += ['--resource-dir', "src/main/resources"]
     installerOptions += ['--vendor', 'Acme Corporation']
     if(currentOs.windows) {
         installerOptions += ['--win-per-user-install', '--win-dir-chooser', '--win-menu', '--win-shortcut']
     }
     else if (currentOs.linux) {
         installerOptions += ['--linux-package-name', 'hellofx','--linux-shortcut']
     }
     else if (currentOs.macOsX) {
         installerOptions += ['--mac-package-name', 'hellofx']
     }
 }
}

When I run my project it comes like this

 04:41:35: Executing task 'Launcher.main()'...

 > Configure project :
 Project : => 'org.example.hellofx' Java module

 FAILURE: Build failed with an exception.

 * Where:
  Build file 'C:\Users\parasu\Documents\badass-runtime-example-javafx-master\build.gradle' line: 4

  * What went wrong:
   An exception occurred applying plugin request [id: 'org.beryx.runtime', version: '1.11.3']
   > Failed to apply plugin [id 'org.beryx.runtime']
    > This plugin works only with non-modular applications.
     For modular applications use https://github.com/beryx/badass-jlink-plugin/.

   * Try: 
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to 
    get full insights.

 * Get more help at https://help.gradle.org

 BUILD FAILED in 528ms
 04:41:37: Task execution finished 'Launcher.main()'.

How can I solve this ???

Srijan-Sengupta commented 3 years ago

Hey @parasuraam , if you want to have a modular build, you must use jlink plugin instead of runtime plugin. YOU MUST ALSO READ THESE DOCS CAREFULLY https://badass-jlink-plugin.beryx.org/releases/latest

ghost commented 3 years ago

Hey @parasuraam , if you want to have a modular build, you must use jlink plugin instead of runtime plugin. YOU MUST ALSO READ THESE DOCS CAREFULLY https://badass-jlink-plugin.beryx.org/releases/latest

Then , how can I build the jpackage ?

Srijan-Sengupta commented 3 years ago

according to the docs, jpackage task is already given. If you want to configure the jpackage build, read these to do so, https://badass-jlink-plugin.beryx.org/releases/latest/#_jpackage .