1

I am trying tu run mvn clean compile on my Eclipse project with module-info.java present. However the build ends up with many errors like:

package javafx.XY does not exist (All referring to JavaFX packages) and

can not find symbol ... (All referring to JavaFX classes).

Example of error output (Whole is not necessary. There are no other types of errors):

[ERROR] /home/gitrow/Desktop/ispf-new/ispf/desktop.common/src/main/java/desktop/controller/registry/Registry.java:[82,17] cannot find symbol
[ERROR]   symbol:   class Button
[ERROR]   location: class desktop.controller.registry.Registry
[ERROR] /home/gitrow/Desktop/ispf-new/ispf/desktop.common/src/main/java/desktop/controller/registry/AbstractTableViewController.java:[3,28] package javafx.scene.control does not exist
[ERROR] /home/gitrow/Desktop/ispf-new/ispf/desktop.common/src/main/java/desktop/controller/registry/Registry.java:[185,23] cannot find symbol
[ERROR]   symbol:   class ActionEvent
[ERROR]   location: class desktop.controller.registry.Registry

Without module-info.java, running mvn clean compile ends up with success.

All packages from my project are 'exported'. All javafx packages are 'required':

module-info:

module desktop.common
{
    requires transitive javafx.base;
    requires transitive javafx.fxml;
    requires transitive javafx.graphics;
    requires transitive javafx.controls;

    requires java.persistence;

    requires org.hibernate.orm.core;
    requires org.hibernate.commons.annotations;

    requires org.apache.logging.log4j;
    requires org.apache.logging.log4j.core;
    requires org.apache.commons.lang3;
    requires org.apache.commons.io;
    requires org.apache.commons.codec;

    requires java.sql;

    requires com.github.albfernandez.javadbf;

    exports desktop.controller.otherstages;
    exports desktop.controller.registry;
    exports desktop.entities;
    exports desktop.core;
    exports desktop.other;
    exports desktop.exceptions;
}

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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>registry</groupId>
    <artifactId>desktop.common</artifactId>
    <version>1.0.0</version>

    <properties>
        <maven.compiler.target>11</maven.compiler.target>
        <maven.compiler.source>11</maven.compiler.source>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.sourceEncoding>UTF-8</project.reporting.sourceEncoding>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-graphics</artifactId>
            <version>17</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>17</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-fxml</artifactId>
            <version>17</version>
            <optional>true</optional>
        </dependency>

        <!-- log4j -->
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>2.14.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>2.14.1</version>
        </dependency>

        <!-- Utilities -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.12.0</version>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.15</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.10.0</version>
        </dependency>
        <dependency>
            <groupId>com.github.albfernandez</groupId>
            <artifactId>javadbf</artifactId>
            <version>1.13.1</version>
        </dependency>

        <!-- JUnit -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>5.7.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>5.7.1</version>
            <scope>test</scope>
        </dependency>

        <!-- Database -->
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>1.4.200</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>5.6.0.Final</version>
        </dependency>
        
    </dependencies>
</project>

Does anyone know what might cause mvn compile not ending up with success with that module-info? (I also tried creating project once more, cleaning, mvn update, making javafx dependencies as not 'optional' in pom).

Using Eclipse 06-2021 and Temurin 11 JDK (new AdoptOpenJDK) (Also does not work with AdoptOpenJDK 16, so there is no problem in JDK)

Wortig
  • 963
  • 2
  • 11
  • 37

0 Answers0