java11(openjdk11.0.2)+openjfx11.0.2:模块x从w和z读取包y

jbose2ul  于 2021-07-09  发布在  Java
关注(0)|答案(1)|浏览(392)

最近,我构建了一个简单的javafx应用程序,并将oraclejdk 10与它的javafx一起使用,之后,我决定更新到java 11(openjdk 11.0.2)+openjfx 11-我得到了以下构建错误:

这是我的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>

这是我的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;
}

更新

我尝试了几种不同的方法来解决这个问题(花了很多时间),但没有一种方法能帮到我。也许有人知道怎么解决这个问题?谢谢?

myzjeezk

myzjeezk1#

作为解决方法,您可以尝试排除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>

不管怎样,这都会给你一个错误。。。因此,可以对group和artifactid使用通配符(*)。虽然这可能是一个解决方法,但我认为真正的问题在于maven的设置。

相关问题