如何解决在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 举报,一经查实,本站将立刻删除。