在org.json:json工件中使用jlink时出现自动模块错误

问题描述

我第一次创建JavaFX项目,并且在导出和部署项目时遇到了一些麻烦。在this tutorial之后,我尝试使用jlink,但遇到错误:

Error: automatic module cannot be used with jlink: json from file:///C:/Users/owner/.m2/repository/org/json/json/20180130/json-20180130.jar
[ERROR] Command execution failed.

我正在使用org.json:json:20180130工件作为项目中的依赖项,这似乎是导致此错误的原因。我已经在SO以及其他一些在线资源上研究了类似的问题。但是由于我只是一个初学者,因此在理解解决方案方面遇到很多麻烦。

我已经阅读了有关添加模块描述符以及使用命令行生成模块信息的信息。但是我不确定该怎么做。

这是我当前的module-info.java(youdolist是我的项目):

module youdolist {
    requires javafx.controls;
    requires javafx.fxml;
    requires javafx.media;
    requires json;

    opens youdolist to javafx.fxml;
    exports youdolist;
}

这是我的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>youdolist</groupId>
    <artifactId>youdolist</artifactId>
    <version>1.0-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-media</artifactId>
            <version>11.0.2</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-fxml</artifactId>
            <version>11.0.2</version>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20180130</version>
            <scope>compile</scope>
        </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.3</version>
                <configuration>
                    <mainClass>youdolist.Main</mainClass>
                </configuration>
            </plugin>

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

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...