GarouDan
04/25/2019, 9:30 PMrootandy
04/25/2019, 9:36 PMid 'com.github.johnrengelman.shadow' version '4.0.4'
)GarouDan
04/25/2019, 9:38 PMamanda.hinchman-dominguez
04/25/2019, 10:19 PMGarouDan
04/26/2019, 12:39 AMStephane M
04/26/2019, 2:43 AMabhinay
04/26/2019, 2:49 AMabhinay
04/26/2019, 2:50 AMabhinay
04/26/2019, 2:51 AMamanda.hinchman-dominguez
04/26/2019, 3:17 AMGarouDan
04/26/2019, 10:32 AM5.4
, so I was trying to move with this solution but it didn’t work.
I was able to create a fatJar with shadow, but when I run it with java -jar ...
it opens the java application but no window appears (starting from IntelliJ it works).
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
kotlin("multiplatform")
id("com.github.johnrengelman.shadow")
id("java")
// id("no.tornado.fxlauncher") version "1.0.20"
}
repositories {
mavenCentral()
}
kotlin {
jvm() {
}
sourceSets {
val jvmMain by getting {
kotlin.srcDir("src/main/kotlin")
resources.srcDir("src/main/resources")
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation("no.tornado:tornadofx:1.7.18")
}
}
val jvmTest by getting {
kotlin.srcDir("src/test/kotlin")
resources.srcDir("src/test/resources")
dependencies {
implementation(kotlin("test"))
implementation(kotlin("test-junit"))
}
}
}
}
tasks {
withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "1.8" // JavaVersion.VERSION_1_8
}
}
}
tasks.withType<ShadowJar> {
manifest {
attributes.put("Main-Class", "com.example.ExampleKt")
}
// Assuming just one target.
val target = kotlin.targets.iterator().next()
from(target.compilations["main"].output)
val runtimeClasspath = target.compilations["main"].compileDependencyFiles as Configuration
configurations = mutableListOf(runtimeClasspath)
}
//fxlauncher {
// applicationVendor = "My Company"
// // Base URL where you will host the application artifacts
// applicationUrl = "<http://fxldemo.tornado.no/>"
// applicationMainClass = "no.tornado.FxlDemo"
// acceptDowngrade = false
// // Optional scp target for application artifacts hosted at the above url
// deployTarget = "<mailto:w48839@fxldemo.tornado.no|w48839@fxldemo.tornado.no>:fxldemo"
//}
If you have any clues how to make this work, please kindly let me know.Stephane M
04/26/2019, 10:35 AMGarouDan
04/26/2019, 10:56 AMGarouDan
04/26/2019, 10:58 AMkotlin
block, of a multiplatform plugin.
Do you know something about this?
For example, with fxlauncher I was able to do something like:
// Assuming just one target.
val target = kotlin.targets.iterator().next()
from(target.compilations["main"].output)
val runtimeClasspath = target.compilations["main"].compileDependencyFiles as Configuration
configurations = mutableListOf(runtimeClasspath)
abhinay
04/26/2019, 2:44 PMGarouDan
04/26/2019, 2:46 PMimplementation(project(":sleeping_accommodation: "))
abhinay
04/26/2019, 2:46 PMGarouDan
04/26/2019, 2:59 PMjava -jar ...
the application started but the application window didn’t appear. If I start from IntelliJ the application window appears normally.abhinay
04/26/2019, 3:02 PMGarouDan
04/26/2019, 3:03 PMGarouDan
04/26/2019, 3:03 PMabhinay
04/26/2019, 3:03 PMabhinay
04/26/2019, 3:04 PMGarouDan
04/26/2019, 3:04 PMGarouDan
04/26/2019, 3:05 PMGarouDan
04/26/2019, 3:15 PMGarouDan
04/26/2019, 3:21 PM.dmg
, .exe
, .deb
files, but if is not possible it would be ok to be using a fat jarGarouDan
04/26/2019, 3:25 PMamanda.hinchman-dominguez
04/26/2019, 3:38 PMamanda.hinchman-dominguez
04/26/2019, 3:38 PMamanda.hinchman-dominguez
04/26/2019, 3:39 PMGarouDan
04/26/2019, 5:01 PMGarouDan
04/27/2019, 1:08 AMjavafx-gradle-plugin
I think could help, but I don’t know how to include the dependencies of the kotlin multiplatform there.
fxlauncher
could be a good option but to me doesn’t work with my gradle versionabhinay
04/27/2019, 4:16 AMjavafx-gradle-plugin
and you should be able to start running and create native bundles in no time.
apply plugin: 'javafx-gradle-plugin'
jfx {
// minimal requirement for jfxJar-task
mainClass = 'full.qualified.nameOf.TheMainClass'
// minimal requirement for jfxNative-task
vendor = 'YourName'
}
This is all you need to get started.GarouDan
04/27/2019, 12:24 PMjfxJar
doesn’t contain any dependencies, only the manifest.
I think this is because the dependencies are beeing configured in the kotin {...}
block, since I’m using the kotlin("multiplatform")
plugin.
With the shadowJar I was able to input the correct dependencies with:
// Assuming just one target.
val target = kotlin.targets.iterator().next()
from(target.compilations["main"].output)
val runtimeClasspath = target.compilations["main"].compileDependencyFiles as Configuration
configurations = mutableListOf(runtimeClasspath)
but I couldn’t find a way to do this with javafx-gradle-plugin
yet.
If you have any clues, please kindly let me know.abhinay
04/27/2019, 12:33 PM