petr-panteleyev / jpackage-gradle-plugin

JPackage Gradle Plugin
https://codeberg.org/petr-panteleyev/jpackage-gradle-plugin
BSD 2-Clause "Simplified" License
97 stars 13 forks source link

task jpackage leave misleading warning #30

Closed miurahr closed 11 months ago

miurahr commented 11 months ago

Task jpackage leaves warning even when it find a jpackage command. It is better to remember warnings in search process, then when not found all the places, the task outputs all warnings. Otherwise quiet.

in default log level

> Task :jpackage
File /usr/lib/jvm/temurin-11-jdk-amd64/bin/jpackage does not exist

with --info

> Task :jpackage
Caching disabled for task ':jpackage' because:
  Caching has not been enabled for the task
Task ':jpackage' is not up-to-date because:
  Task has not declared any outputs despite executing actions.
Looking for jpackage in toolchain
toolchain: /usr/lib/jvm/temurin-11-jdk-amd64
File /usr/lib/jvm/temurin-11-jdk-amd64/bin/jpackage does not exist
Getting jpackage from java.home
Using: /usr/lib/jvm/java-17-openjdk-amd64/bin/jpackage, major version: 17
miurahr commented 11 months ago

Reproduce procedure:

    java {
        toolchain {
            languageVersion = JavaLanguageVersion.of(11)
            vendor = JvmVendorSpec.ADOPTIUM
        }
    }

tasks.jpackage {
    dependsOn jars

    input = file(layout.buildDirectory.file('jars'))
    destination = file(layout.buildDirectory.file("jpackage/app-image"))
    appName = application.applicationName
    vendor = distAppVendor
    appDescription = distDescription
    mainJar = omegatJarFilename
    mainClass = "org.omegat.Main"
    javaOptions = ["-Xmx1024M", "--add-opens", "java.desktop/sun.awt.X11=ALL-UNNAMED"]

    type = 'app-image'
    group 'other'
}

JDK: Temurin OpenJDK 17.0.9+9 OS: Linux Mint 21.2

petr-panteleyev commented 11 months ago

Toolchain is supposed to provide all tools including jpackage. Example above shows suspicious case when everything is compiled by one JDK and jpackage is taken from another JDK. The warning seems perfectly valid to me. If this is intentional then the warning can be ignored.