0

Recently I build a simple JavaFX application and I used OracleJDK 10 with it's JavaFX, after that, I've made a decision to update to Java 11 (OpenJDK 11.0.2) + OpenJFX 11 - I got the build errors below: enter image description here

Here is my pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>store.management.desktop</groupId>
<artifactId>desktop</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>desktop</name>

<properties>
    <java.version>11</java.version>
    <maven.compiler.source>${java.version}</maven.compiler.source>
    <maven.compiler.target>${java.version}</maven.compiler.target>
    <unirest.version>1.4.9</unirest.version>
    <jackson.version>2.9.8</jackson.version>
    <hibernate.version>5.2.12.Final</hibernate.version>
    <jbos.transaction.api.version>2.0.0.Alpha1</jbos.transaction.api.version>
    <flyway.version>5.2.4</flyway.version>
    <jfoenix>9.0.2</jfoenix>
    <h2.version>1.4.197</h2.version>
</properties>

<build>
    <finalName>desktop</finalName>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.0</version>
            <configuration>
                <release>${java.version}</release>
                <source>${java.version}</source>
                <target>${java.version}</target>
            </configuration>
        </plugin>
    </plugins>
</build>

<dependencies>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>${jackson.version}</version>
    </dependency>
    <dependency>
        <groupId>com.mashape.unirest</groupId>
        <artifactId>unirest-java</artifactId>
        <version>${unirest.version}</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>${hibernate.version}</version>
    </dependency>
    <dependency>
        <groupId>org.flywaydb</groupId>
        <artifactId>flyway-maven-plugin</artifactId>
        <version>${flyway.version}</version>
    </dependency>
    <dependency>
        <groupId>com.jfoenix</groupId>
        <artifactId>jfoenix</artifactId>
        <version>${jfoenix}</version>
    </dependency>

    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <version>${h2.version}</version>
    </dependency>

    <!-- FontawesomeFX -->
    <dependency>
        <groupId>de.jensd</groupId>
        <artifactId>fontawesomefx-commons</artifactId>
        <version>9.1.2</version>
    </dependency>
    <dependency>
        <groupId>de.jensd</groupId>
        <artifactId>fontawesomefx-fontawesome</artifactId>
        <version>4.7.0-9.1.2</version>
    </dependency>
    <dependency>
        <groupId>de.jensd</groupId>
        <artifactId>fontawesomefx-materialdesignfont</artifactId>
        <version>2.0.26-9.1.2</version>
    </dependency>

    <dependency>
        <groupId>javax.activation</groupId>
        <artifactId>javax.activation-api</artifactId>
        <version>1.2.0</version>
    </dependency>
    <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <version>2.3.0</version>
    </dependency>
    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-core</artifactId>
        <version>2.3.0</version>
    </dependency>
    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-impl</artifactId>
        <version>2.3.0</version>
    </dependency>

    <!-- JavaFX - OpenJFX -->
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-controls</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.openjfx</groupId>
        <artifactId>javafx-base</artifactId>
        <version>11.0.2</version>
    </dependency>

</dependencies>

here is my module-info.java

module store.management.desktop {
    requires unirest.java;
    requires jackson.annotations;
    requires com.fasterxml.jackson.databind;

    requires com.jfoenix;

    requires javafx.graphics;
    requires javafx.fxml;
    requires javafx.controls;
    requires javafx.base;
    requires java.desktop;

    requires hibernate.jpa;
    requires hibernate.core;
    requires org.flywaydb.core;
    requires com.fasterxml.jackson.core;

    exports store.management.desktop;
}

UPDATE enter image description here

I've tried several different approaches to solve the issue (spent a lot of time) but no one of the approach helps me. Maybe some one know how to fix this issue? Thanks

Tymur Berezhnoi
  • 706
  • 1
  • 14
  • 27
  • Its for everything, not only fx(hibernate as well). So I think the problem is not with the pom but with the m2. (where you are pulling from?) – kai Feb 04 '19 at 12:23
  • @kai if you mean maven repo so it's: https://mvnrepository.com/ – Tymur Berezhnoi Feb 04 '19 at 12:25
  • How do you build it? It works fine for me – José Pereda Feb 04 '19 at 12:26
  • @JoséPereda via intellij ijdea - I've just attached config screen shot. And how do you build it? – Tymur Berezhnoi Feb 04 '19 at 12:29
  • I have to admit i am not sure but it seems to have conflicting sources and doesn't know which one to take. Id' look at the maven settings and the maven cache for some clue why it tries this two sources. – kai Feb 04 '19 at 12:29
  • So you are not using Maven to build it? Have you tried `mvn clean compile`? – José Pereda Feb 04 '19 at 12:31
  • maybe but I see marven.artifact and maven.core and I think it doesn't know which one to use or has them mixed up somehow, as if a maven source was added for the update that wasn't there before or something like that. – kai Feb 04 '19 at 12:42
  • @JoséPereda if I do `mvn clean compile` - it works just fine but anyway I can't run the app via IDE – Tymur Berezhnoi Feb 04 '19 at 18:46
  • 1
    You need to understand the difference between using build tools or the IDE. You can still use the IDE of course, but then you need to do some extra work. I'd suggest you read the documentation https://openjfx.io/openjfx-docs/#IDE-Intellij (See modular from IDE and from Maven). – José Pereda Feb 04 '19 at 18:49
  • @JoséPereda I understand the difference, anyway I can compile/install and even run (with additional plugin) the app via maven - it’s ok, but during development I still need to run the app via IntelliJ IDEA (need debug mode at least ) - unfortunately there is the issue... I followed by the tutorial from the openjfx, with their samples it works but when there are more dependencies like in mine project the issue appears again... – Tymur Berezhnoi Feb 04 '19 at 20:30

1 Answers1

0

As a workaround you can try to exclude a source in your pom:

<dependency>
    <groupId>org.openjfx</groupId>
    <artifactId>javafx-controls</artifactId>
    <version>11.0.2</version>
        <exclusions>
            <exclusion>
                <groupId>org.apache.maven</groupId>
                <artifactId>maven-core</artifactId>
            </exclusion>
        </exclusions>
 </dependency>

For everything, that gives you an error... Therefore you may use a wildcard(*) for group and artifactId. While this may be a workaround, I think the real problem is in the maven setup.

kai
  • 894
  • 1
  • 7
  • 15