Nils Schmidt
Nils Schmidt

Reputation: 21

Required filename-based automodules detected. Please don't publish this project to a public artifact repository

so i made a very simple java Project with Maven in which i used a Libary jnativehook and in intellij it works just fine but when i use jlink to export it this Warning comes up

Required filename-based automodules detected. Please don't publish this project to a public artifact repository!

followed by this error Message

Failed to execute goal org.openjfx:javafx-maven-plugin:0.0.6:jlink (default-cli) on project hellofx: Error

i searched but Nothing really helped

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>org.openjfx</groupId>
<artifactId>hellofx</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.release>11</maven.compiler.release>
    <javafx.version>17.0.0.1</javafx.version>
    <javafx.maven.plugin.version>0.0.6</javafx.maven.plugin.version>
</properties>
<dependencies>
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-controls</artifactId>
        <version>${javafx.version}</version>
    </dependency>
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-fxml</artifactId>
        <version>${javafx.version}</version>
    </dependency>
    <dependency>
        <groupId>com.1stleg</groupId>
        <artifactId>jnativehook</artifactId>
        <version>2.1.0</version>
    </dependency>

</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <release>${maven.compiler.release}</release>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-maven-plugin</artifactId>
            <version>${javafx.maven.plugin.version}</version>
            <configuration>

                <launcher>hellofx</launcher>
                <mainClass>Listener</mainClass>
            </configuration>
        </plugin>
    </plugins>
</build>

and my module-info.java

module Listener {


requires javafx.controls;
requires javafx.fxml;
requires jnativehook;
requires java.logging;


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

so i tested something I removed everything that has to do with jNativeHook https://github.com/kwhat/jnativehook and it worked but i need jNativehook has anyone an idea to solve this or does anyone had a simiular problem

Upvotes: 0

Views: 1159

Answers (2)

Konrad Neitzel
Konrad Neitzel

Reputation: 760

First of all to understand the problem: What does "Required filename-based automodules detected." warning mean?

The solution could simply be to use the latest version of the dependency: https://mvnrepository.com/artifact/com.github.kwhat/jnativehook/2.2.1 Be aware that the goupId changed! You are using the old one and the homepage of the dependency (you provided the link yourself) is giving you the correct groupId - you should really use that.

If that does not solve the issue, then a fix in that dependency is required and you should contact the authors of the dependency.

But from what I see, it should work - but be aware that your module-info.java should use com.github.kwhat.jnativehook instead of just jnativehook.

Upvotes: 0

Bhaskar Gundu
Bhaskar Gundu

Reputation: 38

your artifact-id in pom is hellofx, whereas your module name is Listener. Change your module name to hellofx or change the artifact-id in pom to be Listener. Make both of them the same.

Upvotes: 0

Related Questions