运行javafx应用程序-引导层初始化期间发生错误:java.lang.module.ResolutionException

问题描述

正如标题所述,我只是尝试运行javafx应用程序。但是,我不知道为什么会收到此错误,也不知道为什么该错误引用了sisu.inject.beanaopalliance模块。我不知道是否是module-info.java或pom.xml引起了错误。在此先感谢您的协助。

module-info.java:

module ui {
    requires javafx.fxml;
    requires transitive javafx.graphics;
    requires javafx.controls;
    requires org.testfx.junit5;
    requires junit;
    requires core;
    exports ui.java;
    exports test.ui to junit;
}

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">

    <parent>
        <groupId>it1901.nachwithme</groupId>
        <artifactId>parent</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>ui</artifactId>

    <dependencies>
        <!-- UI imports core as a dependency -->
        <dependency>
            <groupId>it1901.nachwithme</groupId>
            <artifactId>core</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>
        <!-- Dependencies for javafx -->
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-fxml</artifactId>
        </dependency>
        <dependency>
            <groupId>org.testfx</groupId>
            <artifactId>testfx-core</artifactId>
            <exclusions>
                <exclusion>
                    <!-- https://mvnrepository.com/artifact/org.sonatype.sisu/sisu-inject-bean -->
                    <groupId>org.sonatype.sisu</groupId>
                    <artifactId>sisu-inject-bean</artifactId>
                </exclusion>
                <exclusion>
                    <!-- https://mvnrepository.com/artifact/aopalliance/aopalliance -->
                    <groupId>aopalliance</groupId>
                    <artifactId>aopalliance</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- Dependencies for javafx -->

        <!-- Dependencies for unit-testing -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-graphics</artifactId>
            <version>16-ea+2</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.testfx</groupId>
            <artifactId>testfx-junit5</artifactId>
            <scope>compile</scope>
        </dependency>
        <!-- Dependencies for unit-testing -->
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.openjfx</groupId>
                <artifactId>javafx-maven-plugin</artifactId>
                <configuration>
                    <options>
                        <!-- <option>dash dash enable-preview</option> -->
                    </options>
                    <mainClass>ui.java.App</mainClass>
                </configuration>
            </plugin>
        </plugins>
        <sourceDirectory>src</sourceDirectory>
        <resources>
            <resource>
                <directory>src</directory>
                <includes>
                    <include>**/*.fxml</include>
                    <include>**/*.png</include>
                </includes>
            </resource>
        </resources>
        <testSourceDirectory>src/test</testSourceDirectory>
        <testResources>
            <testResource>
                <directory>test</directory>
                <includes>
                    <include>**/*.fxml</include>
                    <include>**/*.png</include>
                </includes>
            </testResource>
        </testResources>
    </build>
</project>

错误:

Error occurred during initialization of boot layer  
java.lang.module.ResolutionException: Modules sisu.inject.bean and aopalliance export package org.aopalliance.aop to module org.testfx

Process finished with exit code 1

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)