openjfx / javafx-maven-plugin

Maven plugin to run JavaFX 11+ applications
Apache License 2.0
371 stars 59 forks source link

javafx:jlink error with openjdk11 #138

Open fanyify opened 3 years ago

fanyify commented 3 years ago

It works fine with mvn javafx:run, I can see my project running, but when I try mvn javafx:jlink to build up a release package, it complains this error: [INFO] <<< javafx-maven-plugin:0.0.7:jlink (default-cli) < process-classes @ kdts <<< [INFO] [INFO] [INFO] --- javafx-maven-plugin:0.0.7:jlink (default-cli) @ kdts --- ����: Module java.base not found, required by com.kingbase.kdts java.lang.module.FindException: Module java.base not found, required by com.kingbase.kdts at java.base/java.lang.module.Resolver.findFail(Resolver.java:900) at java.base/java.lang.module.Resolver.resolve(Resolver.java:191) at java.base/java.lang.module.Resolver.resolve(Resolver.java:140) at java.base/java.lang.module.Configuration.resolve(Configuration.java:421) at java.base/java.lang.module.Configuration.resolve(Configuration.java:255) at jdk.jlink/jdk.tools.jlink.internal.Jlink$JlinkConfiguration.resolve(Jlink.java:217) at jdk.jlink/jdk.tools.jlink.internal.JlinkTask.createImageProvider(JlinkTask.java:489) at jdk.jlink/jdk.tools.jlink.internal.JlinkTask.createImage(JlinkTask.java:399) at jdk.jlink/jdk.tools.jlink.internal.JlinkTask.run(JlinkTask.java:271) at jdk.jlink/jdk.tools.jlink.internal.Main.run(Main.java:54) at jdk.jlink/jdk.tools.jlink.internal.Main.main(Main.java:33) [ERROR] Command execution failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404) at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166) at org.openjfx.JavaFXBaseMojo.executeCommandLine(JavaFXBaseMojo.java:567) at org.openjfx.JavaFXBaseMojo.executeCommandLine(JavaFXBaseMojo.java:434) at org.openjfx.JavaFXJLinkMojo.execute(JavaFXJLinkMojo.java:209)

LaurentJeanpierre1 commented 3 years ago

I have the same issue with plugins 0.0.6 and 0.0.8

betanzos commented 3 years ago

Hi @fanyify @LaurentJeanpierre1, can you share a full console output using the -X option?

prisme60 commented 2 years ago

I have the same error with OpenJDK17, so I share my full console output with the X option :

JAVA_HOME=/usr/lib/jvm/java-17-openjdk-17.0.1.0.12-2.el8_5.x86_64/ mvn clean javafx:jlink -X > maven_jlink_error.txt 2>&1
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.atis.simuessai.argos</groupId>
    <artifactId>simuessai-argos</artifactId>
    <version>0.0.1</version>

    <url>http://www.alstom.com</url>
    <name>simuessai-argos</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>17.0.0.1</version>
        </dependency>
<!--        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.8.9</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>-->
    </dependencies>
    <build>
      <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
            </plugin>
            <plugin>
                <groupId>org.openjfx</groupId>
                <artifactId>javafx-maven-plugin</artifactId>
                <version>0.0.8</version>
                <configuration>
                    <compress>2</compress>
                    <noHeaderFiles>true</noHeaderFiles>
                    <stripDebug>true</stripDebug>
                    <noManPages>true</noManPages>
                    <release>${maven.compiler.release}</release>
                    <jlinkImageName>simargos</jlinkImageName>
                    <mainClass>com.atis.simuessai.argos/com.atis.simuessai.argos.App</mainClass>
                    <launcher>simargos</launcher>
                    <jlinkZipName>simargos</jlinkZipName>
                </configuration>
            </plugin>

        <!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
        <plugin>
          <artifactId>maven-clean-plugin</artifactId>
          <version>3.1.0</version>
        </plugin>
        <!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
        <plugin>
          <artifactId>maven-resources-plugin</artifactId>
          <version>3.2.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>3.0.0-M5</version>
        </plugin>
        <plugin>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.2.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-install-plugin</artifactId>
          <version>3.0.0-M1</version>
        </plugin>
        <plugin>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>3.0.0-M2</version>
        </plugin>
        <!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
        <plugin>
          <artifactId>maven-site-plugin</artifactId>
          <version>3.10.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-project-info-reports-plugin</artifactId>
          <version>3.1.2</version>
        </plugin>

        </plugins>
      </pluginManagement>
    </build>
</project>

maven_jlink_error.txt

prisme60 commented 2 years ago

I have added missing dependencies to my pom.xml file, but it still fails with the same error (Module java.base not found).

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <maven.compiler.release>17</maven.compiler.release>
        <javafx.version>17.0.1</javafx.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>${javafx.version}</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-base</artifactId>
            <version>${javafx.version}</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-graphics</artifactId>
            <version>${javafx.version}</version>
        </dependency>
    </dependencies>
prisme60 commented 2 years ago

I solve my problem by installing jmods on my Centos :

sudo yum install java-17-openjdk-devel java-17-openjdk-jmods