错误:自动模块不能与jlink一起使用:-Maven与JavaFX

时间:2019-05-31 13:10:19

标签: maven javafx java-11 gluon jlink

我已经通过Maven存储库选择了Apache Commons IO,JSerialComm和Ini4J库。

但是当我尝试通过mvn javafx:jlink创建图像时,出现以下错误:

[INFO] --- javafx-maven-plugin:0.0.2:jlink (default-cli) @ JUSBPlotter ---
[WARNING] Required filename-based automodules detected. Please don't publish this project to a public artifact repository!
Error: automatic module cannot be used with jlink: ini4j from file:///root/.m2/repository/org/ini4j/ini4j/0.5.4/ini4j-0.5.4.jar
[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:447)

我似乎与此有关:

Error: automatic module cannot be used with jlink:

我的模块文件如下:

module org.openjfx.JUSBPlotter {
    requires javafx.controls;
    requires javafx.fxml;
    requires com.fazecast.jSerialComm;
    requires ini4j;
    requires org.apache.commons.io;

    opens org.openjfx.JUSBPlotter to javafx.fxml;
    exports org.openjfx.JUSBPlotter;
}

我的pom.xml看起来像这样:

<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.openjfx</groupId>
    <artifactId>JUSBPlotter</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>11.0.2</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-fxml</artifactId>
            <version>11.0.2</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.6</version>
        </dependency>
        <dependency>
            <groupId>com.fazecast</groupId>
            <artifactId>jSerialComm</artifactId>
            <version>2.5.1</version>
        </dependency>
        <dependency>
            <groupId>org.ini4j</groupId>
            <artifactId>ini4j</artifactId>
            <version>0.5.4</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <release>11</release>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.openjfx</groupId>
                <artifactId>javafx-maven-plugin</artifactId>
                <version>0.0.2</version>
                <configuration>
                    <stripDebug>true</stripDebug>
                    <compress>2</compress>
                    <noHeaderFiles>true</noHeaderFiles>
                    <noManPages>true</noManPages>
                    <launcher>JUSBPlotter</launcher>
                    <jlinkImageName>JUSBPlotter</jlinkImageName>
                    <jlinkZipName>JUSBPlotterZip</jlinkZipName>
                    <mainClass>org.openjfx.JUSBPlotter.Main</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

那么,对于Maven和Jlink来说,Apache Commons IO,JSerialComm和Ini4J是否会过时?

我应该如何解决这个问题? 我正在使用带有OpenJDK 11的Eclipse IDE。

0 个答案:

没有答案