![](/img/trans.png)
[英]Module 'project' reads package 'javafx.beans' from both 'javafx.base' and 'javafx.base'
[英]Assistance to Java Module: Module 'name' reads package 'javafx.beans'
目前,我正在嘗試將maven項目與Java 9的模塊系統鏈接,但是我在每個模塊中都會遇到相同的錯誤..(使用Java 11)
Module 'common' reads package 'javafx.beans' from both 'javafx.base' and 'javafx.base'
我一直在努力工作幾個小時。 到目前為止,我可以得出結論,每次我需要javafx模塊時它都會發生,它可能與復制有關。 在項目結構(Intellij IDEA)中,每個存在兩個,版本11.0.2(我已安裝)和版本11.0.1(來自fontawesomefx)。 如果我刪除所有11.0.1版本,實現將無法正常工作。
module-info.java
module common {
exports common.services;
exports common.sidebar;
requires de.jensd.fx.fontawesomefx.commons;
requires javafx.graphics; // comment both javafx out, no error occurs except in the implementation.
requires javafx.controls;
}
共同的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>
<artifactId>parent</artifactId> <!-- replaced original id -->
<groupId>me.name</groupId> <!-- replaced original name -->
<version>0.0.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>common</artifactId>
<dependencies>
<dependency>
<groupId>de.jensd</groupId>
<artifactId>fontawesomefx-commons</artifactId>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
</dependency>
</dependencies>
</project>
我希望這是足夠的信息,否則我可以提供更多。 謝謝!
所以我今天找到了解決方案。 這完全是關於重復,所以我搜索了是否有可能從依賴項中排除包,它是!
<dependency>
<groupId>de.jensd</groupId>
<artifactId>fontawesomefx-commons</artifactId>
<version>11.0</version>
<exclusions>
<exclusion>
<groupId>org.openjfx</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
我將<exclusions></exclusions>
標簽添加到javafx作為要求的所有其他庫中,並且它有效!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.