I'm creating a JavaFX project for the first time, and I'm having a bit of trouble with exporting and deploying the project. Following this tutorial, I tried using jlink, but ran into an error:
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.
I am using the org.json:json:20180130
artifact as a dependency in the project, and that seems to be the cause of this error. I've looked at similar questions to mine on SO already as well as some other online resources. But I am having a lot of trouble understanding the solutions to them, as I'm only a beginner to this.
I've read about adding a module descriptor, and generating a module-info using the command line. But I'm not sure how to do that.
Here is my module-info.java currently (youdolist is my project):
module youdolist {
requires javafx.controls;
requires javafx.fxml;
requires javafx.media;
requires json;
opens youdolist to javafx.fxml;
exports youdolist;
}
And here is my 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>