beryx / badass-runtime-plugin

Create a custom runtime image of your non-modular application
https://badass-runtime-plugin.beryx.org
Apache License 2.0
162 stars 21 forks source link

Setting distDir doesn't seem to generate correct jpackage input directories #13

Closed edwinRNDR closed 5 years ago

edwinRNDR commented 5 years ago

My gradle build contains a jar task that produces a single executable jar that contains all the required dependencies.

When I try to set the distDir property to File("$build/libs") I get the following.

> Task :jpackageImage FAILED
The jpackage task is experimental. Use it at your own risk.
Error: Input directory specified is not a directory: /Users/edwin/git/one-offs/jpackage-from-gradle/build/install/openrndr-template/lib.

Diving a bit deeper I tried to let distDir point to something that does not exist: "this-does-not-exist"

* What went wrong:
A problem was found with the configuration of task ':runtime'.
> Directory '/Users/edwin/git/one-offs/jpackage-from-gradle/this-does-not-exist' specified for property 'distDir' does not exist.

So here it is able to pass in the right values for jpackage's --input argument.

When I create this directory we are back at the original error message: Error: Input directory specified is not a directory: /Users/edwin/git/one-offs/jpackage-from-gradle/build/install/openrndr-template/lib

siordache commented 5 years ago

When I try to set the distDir property to File("$build/libs") I get the following.

Is this really File("$build/libs")? Or file("build/libs")? Or maybe file("$buildDir/libs")?

distDir should point to a directory containing a distribution. Such a directory is usually created by the installDist or installShadowDist tasks and it should contain a bin subdirectory (where the start scripts reside) and a lib subdirectory (where the jars reside).

The message

Error: Input directory specified is not a directory: /Users/edwin/git/one-offs/jpackage-from-gradle/build/install/openrndr-template/lib.

is issued by the jpackage tool, while the message

Directory '/Users/edwin/git/one-offs/jpackage-from-gradle/this-does-not-exist' specified for property 'distDir' does not exist.

is issued by the plugin itself.

However, I'm not sure why you get this error. I would have expected that gradle succeeds but produces an invalid custom runtime image and installer (because your distDir doesn't have the bin and lib subdirectories).

Can you please post your build.gradle and the output of executing ./gradlew -is clean jpackage?

edwinRNDR commented 5 years ago

Thank you, I have tried both File("build/libs") and File("$buildDir/libs") but somehow conflated that in to $build.

I will create a minimal build.gradle to demonstrate tomorrow.

edwinRNDR commented 5 years ago

My build.gradle.kts


val kotlinVersion = "1.3.41"

plugins {
    java
    kotlin("jvm") version("1.3.41")
    id("org.beryx.runtime") version "1.2.1"
}
group = "test.package"
version = "0.0.1"

val applicationMainClass = "TemplateProgramKt"

repositories {
    mavenCentral()
}

dependencies {
    implementation(kotlin("stdlib-jdk8"))
    testCompile("junit", "junit", "4.12")
}

configure<JavaPluginConvention> {
    sourceCompatibility = JavaVersion.VERSION_1_8
}
tasks.withType<KotlinCompile> {
    kotlinOptions.jvmTarget = "1.8"
}

tasks.withType<Jar> {
    manifest {
        attributes["Main-Class"] = applicationMainClass
    }
    doFirst {
        from(configurations.compileClasspath.get().map { if (it.isDirectory) it else zipTree(it) })
        from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) })
    }

    exclude(listOf("META-INF/*.RSA", "META-INF/*.SF", "META-INF/*.DSA", "**/module-info*"))
    archiveFileName.set("application.jar")
}

application {
    mainClassName = applicationMainClass
    applicationName = "demo"
}

runtime {
    jpackage {
        distDir.set(File("$buildDir/libs"))
        skipInstaller = true
        imageName = "demo"
    }
}

Output of gradlew -is clean jpackage


The client will now receive all logging from the daemon (pid: 89186). The daemon log file: /Users/edwin/.gradle/daemon/5.2.1/daemon-89186.out.log
Starting 57th build in daemon [uptime: 23 hrs 42 mins 7.196 secs, performance: 100%]
Using 8 worker leases.
Starting Build
Settings evaluated using settings file '/Users/edwin/git/one-offs/jpackage-from-gradle/settings.gradle'.
Projects loaded. Root project using build file '/Users/edwin/git/one-offs/jpackage-from-gradle/build.gradle.kts'.
Included projects: [root project 'openrndr-template']

> Configure project :
Evaluating root project 'openrndr-template' using build file '/Users/edwin/git/one-offs/jpackage-from-gradle/build.gradle.kts'.
kotlin scripting plugin: created the scripting discovery configuration: kotlinScriptDef
kotlin scripting plugin: created the scripting discovery configuration: testKotlinScriptDef
All projects evaluated.
Selected primary task 'clean' from project :
Selected primary task 'jpackage' from project :
Tasks to be executed: [task ':clean', task ':compileKotlin', task ':compileJava', task ':processResources', task ':classes', task ':inspectClassesForKotlinIC', task ':jar', task ':startScripts', task ':installDist', task ':jre', task ':runtime', task ':jpackageImage', task ':jpackage']
:clean (Thread[Execution worker for ':',5,main]) started.

> Task :clean
Task ':clean' is not up-to-date because:
  Task has not declared any outputs despite executing actions.
:clean (Thread[Execution worker for ':',5,main]) completed. Took 0.062 secs.
:compileKotlin (Thread[Execution worker for ':',5,main]) started.

> Task :compileKotlin
Task ':compileKotlin' is not up-to-date because:
  Class path of task ':compileKotlin' has changed from 4dc6267b3b72ca6e54379fe89c4bbc14 to e5554535031f9cbfaa6b7391ebe558ae.
All input files are considered out-of-date for incremental task ':compileKotlin'.
file or directory '/Users/edwin/git/one-offs/jpackage-from-gradle/src/main/java', not found
file or directory '/Users/edwin/git/one-offs/jpackage-from-gradle/src/main/java', not found
Using Kotlin/JVM incremental compilation
Options for KOTLIN DAEMON: IncrementalCompilationOptions(super=CompilationOptions(compilerMode=INCREMENTAL_COMPILER, targetPlatform=JVM, reportCategories=[0], reportSeverity=2, requestedCompilationResults=[0]kotlinScriptExtensions=[kt, kts, java]), areFileChangesKnown=false, modifiedFiles=null, deletedFiles=null, workingDir=/Users/edwin/git/one-offs/jpackage-from-gradle/build/kotlin/compileKotlin, multiModuleICSettings=MultiModuleICSettings(buildHistoryFile=/Users/edwin/git/one-offs/jpackage-from-gradle/build/kotlin/compileKotlin/build-history.bin, useModuleDetection=false), usePreciseJavaTracking=trueoutputFiles=[/Users/edwin/git/one-offs/jpackage-from-gradle/build/classes/kotlin/main, /Users/edwin/git/one-offs/jpackage-from-gradle/build/kotlin/compileKotlin])
:compileKotlin (Thread[Execution worker for ':',5,main]) completed. Took 0.562 secs.
:compileJava (Thread[Execution worker for ':',5,main]) started.

> Task :compileJava NO-SOURCE
file or directory '/Users/edwin/git/one-offs/jpackage-from-gradle/src/main/java', not found
Skipping task ':compileJava' as it has no source files and no previous output files.
:compileJava (Thread[Execution worker for ':',5,main]) completed. Took 0.0 secs.
:processResources (Thread[Execution worker for ':',5,main]) started.

> Task :processResources NO-SOURCE
file or directory '/Users/edwin/git/one-offs/jpackage-from-gradle/src/main/resources', not found
Skipping task ':processResources' as it has no source files and no previous output files.
:processResources (Thread[Execution worker for ':',5,main]) completed. Took 0.0 secs.
:classes (Thread[Execution worker for ':',5,main]) started.

> Task :classes UP-TO-DATE
Skipping task ':classes' as it has no actions.
:classes (Thread[Execution worker for ':',5,main]) completed. Took 0.0 secs.
:inspectClassesForKotlinIC (Thread[Execution worker for ':',5,main]) started.

> Task :inspectClassesForKotlinIC
Task ':inspectClassesForKotlinIC' is not up-to-date because:
  Class path of task ':inspectClassesForKotlinIC' has changed from 4dc6267b3b72ca6e54379fe89c4bbc14 to e5554535031f9cbfaa6b7391ebe558ae.
file or directory '/Users/edwin/git/one-offs/jpackage-from-gradle/build/classes/java/main', not found
:inspectClassesForKotlinIC (Thread[Execution worker for ':',5,main]) completed. Took 0.003 secs.
:jar (Thread[Execution worker for ':',5,main]) started.

> Task :jar
Task ':jar' is not up-to-date because:
  One or more additional actions for task ':jar' have changed.
Custom actions are attached to task ':jar'.
:jar (Thread[Execution worker for ':',5,main]) completed. Took 0.426 secs.
:startScripts (Thread[Execution worker for ':',5,main]) started.

> Task :startScripts
Task ':startScripts' is not up-to-date because:
  Output property 'outputDir' file /Users/edwin/git/one-offs/jpackage-from-gradle/build/scripts has been removed.
  Output property 'outputDir' file /Users/edwin/git/one-offs/jpackage-from-gradle/build/scripts/demo has been removed.
  Output property 'outputDir' file /Users/edwin/git/one-offs/jpackage-from-gradle/build/scripts/demo.bat has been removed.
:startScripts (Thread[Execution worker for ':',5,main]) completed. Took 0.037 secs.
:installDist (Thread[Execution worker for ':',5,main]) started.

> Task :installDist
Task ':installDist' is not up-to-date because:
  Output property 'destinationDir' file /Users/edwin/git/one-offs/jpackage-from-gradle/build/install/demo has been removed.
  Output property 'destinationDir' file /Users/edwin/git/one-offs/jpackage-from-gradle/build/install/demo/bin has been removed.
  Output property 'destinationDir' file /Users/edwin/git/one-offs/jpackage-from-gradle/build/install/demo/bin/demo has been removed.
Custom actions are attached to task ':installDist'.
:installDist (Thread[Execution worker for ':',5,main]) completed. Took 0.045 secs.
:jre (Thread[Execution worker for ':',5,main]) started.

> Task :jre
Task ':jre' is not up-to-date because:
  Class path of task ':jre' has changed from 4dc6267b3b72ca6e54379fe89c4bbc14 to e5554535031f9cbfaa6b7391ebe558ae.
taskData: org.beryx.runtime.data.JreTaskData(jreDir:/Users/edwin/git/one-offs/jpackage-from-gradle/build/jre, options:[], modules:[], javaHome:/Users/edwin/.sdkman/candidates/java/11.0.2-open, targetPlatforms:[:])
Cannot find module exporting kotlin
Cannot find module exporting kotlin.collections
Cannot find module exporting kotlin.internal
Cannot find module exporting kotlin.internal.jdk7
Cannot find module exporting kotlin.jvm
Cannot find module exporting kotlin.jvm.internal
Cannot find module exporting kotlin.random
Cannot find module exporting kotlin.ranges
Cannot find module exporting kotlin.sequences
Cannot find module exporting kotlin.text
Cannot find module exporting org.jetbrains.annotations
Executing: [/Users/edwin/.sdkman/candidates/java/11.0.2-open/bin/jlink, -v, --module-path, /Users/edwin/.sdkman/candidates/java/11.0.2-open/jmods/, --add-modules, java.base, --output, /Users/edwin/git/one-offs/jpackage-from-gradle/build/jre]
Starting process 'command '/Users/edwin/.sdkman/candidates/java/11.0.2-open/bin/jlink''. Working directory: /Users/edwin/git/one-offs/jpackage-from-gradle Command: /Users/edwin/.sdkman/candidates/java/11.0.2-open/bin/jlink -v --module-path /Users/edwin/.sdkman/candidates/java/11.0.2-open/jmods/ --add-modules java.base --output /Users/edwin/git/one-offs/jpackage-from-gradle/build/jre
Successfully started process 'command '/Users/edwin/.sdkman/candidates/java/11.0.2-open/bin/jlink''
java.base file:///Users/edwin/.sdkman/candidates/java/11.0.2-open/jmods/java.base.jmod

Providers:
  java.base provides java.nio.file.spi.FileSystemProvider used by java.base

:jre (Thread[Execution worker for ':',5,main]) completed. Took 1.947 secs.
:runtime (Thread[Execution worker for ':',5,main]) started.

> Task :runtime
Task ':runtime' is not up-to-date because:
  Class path of task ':runtime' has changed from 4dc6267b3b72ca6e54379fe89c4bbc14 to e5554535031f9cbfaa6b7391ebe558ae.
taskData: org.beryx.runtime.data.RuntimeTaskData(distDir:/Users/edwin/git/one-offs/jpackage-from-gradle/build/libs, jreDir:/Users/edwin/git/one-offs/jpackage-from-gradle/build/jre, imageDir:/Users/edwin/git/one-offs/jpackage-from-gradle/build/image, options:[], modules:[], javaHome:/Users/edwin/.sdkman/candidates/java/11.0.2-open, targetPlatforms:[:])
:runtime (Thread[Execution worker for ':',5,main]) completed. Took 0.44 secs.
:jpackageImage (Thread[Execution worker for ':',5,main]) started.

> Task :jpackageImage FAILED
Task ':jpackageImage' is not up-to-date because:
  Task has failed previously.
taskData: org.beryx.runtime.data.JPackageTaskData(mainClass:TemplateProgramKt, jreDir:null, imageDir:/Users/edwin/git/one-offs/jpackage-from-gradle/build/image, runtimeImageDir:/Users/edwin/git/one-offs/jpackage-from-gradle/build/image, jpackageData:org.beryx.runtime.data.JPackageData(jpackageHome:/Users/edwin/.sdkman/candidates/java/current, outputDir:jpackage, imageOutputDir:/Users/edwin/git/one-offs/jpackage-from-gradle/build/jpackage, imageName:demo, imageOptions:[], targetPlatformName:null, skipInstaller:true, installerType:null, installerOutputDir:/Users/edwin/git/one-offs/jpackage-from-gradle/build/jpackage, installerName:openrndr-template, installerOptions:[], jvmArgs:[]))
The jpackage task is experimental. Use it at your own risk.
input subdir: openrndr-template
Starting process 'command '/Users/edwin/.sdkman/candidates/java/current/bin/jpackage''. Working directory: /Users/edwin/git/one-offs/jpackage-from-gradle Command: /Users/edwin/.sdkman/candidates/java/current/bin/jpackage --input /Users/edwin/git/one-offs/jpackage-from-gradle/build/install/openrndr-template/lib --main-jar application.jar --main-class TemplateProgramKt --output /Users/edwin/git/one-offs/jpackage-from-gradle/build/jpackage --name demo --runtime-image /Users/edwin/git/one-offs/jpackage-from-gradle/build/image
Successfully started process 'command '/Users/edwin/.sdkman/candidates/java/current/bin/jpackage''
Error: Input directory specified is not a directory: /Users/edwin/git/one-offs/jpackage-from-gradle/build/install/openrndr-template/lib.

:jpackageImage (Thread[Execution worker for ':',5,main]) completed. Took 0.302 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':jpackageImage'.
> Process 'command '/Users/edwin/.sdkman/candidates/java/current/bin/jpackage'' finished with non-zero exit value 1

* Try:
Run with --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':jpackageImage'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$2.accept(ExecuteActionsTaskExecuter.java:121)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$2.accept(ExecuteActionsTaskExecuter.java:117)
    at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:184)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:110)
    at org.gradle.api.internal.tasks.execution.ResolveIncrementalChangesTaskExecuter.execute(ResolveIncrementalChangesTaskExecuter.java:84)
    at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:91)
    at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionStateTaskExecuter.execute(ResolveBeforeExecutionStateTaskExecuter.java:74)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:109)
    at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionOutputsTaskExecuter.execute(ResolveBeforeExecutionOutputsTaskExecuter.java:67)
    at org.gradle.api.internal.tasks.execution.ResolveAfterPreviousExecutionStateTaskExecuter.execute(ResolveAfterPreviousExecutionStateTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:93)
    at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:45)
    at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:94)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:63)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:49)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:46)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:46)
    at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:43)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:355)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:134)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:129)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:202)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193)
    at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:129)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: org.gradle.process.internal.ExecException: Process 'command '/Users/edwin/.sdkman/candidates/java/current/bin/jpackage'' finished with non-zero exit value 1
    at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:396)
    at org.gradle.process.ExecResult$assertNormalExitValue.call(Unknown Source)
    at org.beryx.runtime.impl.JPackageImageTaskImpl.execute(JPackageImageTaskImpl.groovy:68)
    at org.beryx.runtime.JPackageImageTask.jpackageTaskAction(JPackageImageTask.groovy:65)
    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 org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:103)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:48)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:41)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:705)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:672)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$4.run(ExecuteActionsTaskExecuter.java:338)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:327)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:312)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$200(ExecuteActionsTaskExecuter.java:75)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:158)
    at org.gradle.internal.execution.impl.steps.ExecuteStep.execute(ExecuteStep.java:46)
    at org.gradle.internal.execution.impl.steps.CancelExecutionStep.execute(CancelExecutionStep.java:34)
    at org.gradle.internal.execution.impl.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:69)
    at org.gradle.internal.execution.impl.steps.TimeoutStep.execute(TimeoutStep.java:49)
    at org.gradle.internal.execution.impl.steps.CatchExceptionStep.execute(CatchExceptionStep.java:34)
    at org.gradle.internal.execution.impl.steps.CreateOutputsStep.execute(CreateOutputsStep.java:49)
    at org.gradle.internal.execution.impl.steps.SnapshotOutputStep.execute(SnapshotOutputStep.java:42)
    at org.gradle.internal.execution.impl.steps.SnapshotOutputStep.execute(SnapshotOutputStep.java:28)
    at org.gradle.internal.execution.impl.steps.CacheStep.executeWithoutCache(CacheStep.java:133)
    at org.gradle.internal.execution.impl.steps.CacheStep.lambda$execute$5(CacheStep.java:83)
    at org.gradle.internal.execution.impl.steps.CacheStep.execute(CacheStep.java:82)
    at org.gradle.internal.execution.impl.steps.CacheStep.execute(CacheStep.java:37)
    at org.gradle.internal.execution.impl.steps.PrepareCachingStep.execute(PrepareCachingStep.java:33)
    at org.gradle.internal.execution.impl.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:38)
    at org.gradle.internal.execution.impl.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:23)
    at org.gradle.internal.execution.impl.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:95)
    at org.gradle.internal.execution.impl.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:88)
    at org.gradle.internal.execution.impl.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:52)
    at org.gradle.internal.execution.impl.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:36)
    at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:34)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:109)
    ... 37 more

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

BUILD FAILED in 4s
9 actionable tasks: 9 executed
14:54:30: Task execution finished 'jpackage -is clean jpackage'.
siordache commented 5 years ago

Fixed in 1.3.0.

Two new properties are available in the jpackage block: mainJar and mainClass. You may need them if the jar name and the main class name of your distribution do not coincide with those typically produced by the installDist or installShadowDist task.

Example:

runtime {
    jpackage {
        distDir.set(File("$buildDir/libs"))
        skipInstaller = true
        imageName = "demo"
        jpackage {
            mainClass = "org.example.MyGreatApp"
            mainJar = "my-fat-lib-1.0.0.jar"
        }
    }
}

Keep in mind that your "$buildDir/libs" should be a proper distribution, which contains the bin and lib subdirectories.

ogrammer commented 4 years ago

@siordache Any chance that you can add this to badass-jlink-plugin (gradle) as well? I have a task that modifies the .jar generated from the jar task (jpackage.dependsOn myTask; myTask.mustRunAfter jar) and creates a new one, but I cannot get the plugin jpackage nor jlink to use the new jar. Or is there a better way?

siordache commented 4 years ago

It should be possible, although not in the same form as for the badass-runtime-plugin, because the modified jar should be already known by the jlink task. However, you probably can solve your problem without such a feature. Try something like this:

tasks.myTask.dependsOn prepareModulesDir
tasks.jlink.dependsOn myTask
tasks.jlink.doFirst {
    def archiveName = jar.archiveFile.asFile.get().name
    delete "${jlinkJarsDir.asFile}/$archiveName"
    copy{
        from '<path-to-the-jar-produced-by-myTask>'
        into jlinkJarsDir.asFile
    }
}
ogrammer commented 4 years ago

Forgot to respond. Thanks, my solution was to rename the original jar to something like -unmodified.jar and the modified to just .jar, but that was pretty weird. Your solution is better, thank you!