As the title says, I'm just trying to run the javafx application. However I have no idea why I'm getting this error, and I don't know why the error is referencing the sisu.inject.bean
and aopalliance
modules. I don't know wether the module-info.java or the pom.xml is causing the error. Thanks in advance for any anwser.
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:
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
TL;DR — The two modules have a split package in common. And JPMS forbids split packages.
The long-winded version
The first sentence of this 2010 blog gives a summary of what a split package is…1
Keep in mind that was written in 2010 though; before JPMS. So the blog's claim of „without any problem at both compile and runtime“ in the second sentence is out-of-date; for the modulepath in any case.
For a way more detailed, more up-to-date explanation, watch this Project Jigsaw: Under the Hood video from JavaOne 2016.2
Because your project has a module descriptor (module-info.java) Maven has put those dependencies — which I can see you declared in your pom — on the modulepath.
Because JPMS abhors split packages…3
The solution
1 That blog talks about OSGi. But the core split package definition applies to JPMS too.
2 Project Jigsaw: Under The Hood — accompanying slides.
3 Rémi Forax — The split package problem — Jigsaw Dev Mailing List — November 2016.