Есть приложение из двух модулей. Структура такая:
Dart
---- src
-------- java
------------ org
---------------- dart
-------------------- Awe.java
---------------- module-info.java
-------- resources
------------ xxx
---------------- qqq.txt
---- pom.xml
Furd
---- src
-------- java
------------ com
---------------- furd
-------------------- Qwe.java
---------------- module-info.java
-------- resources
------------ xxx
---------------- qqq.txt
---- pom.xml
Содержимое "Awe.java" из "Dart":
package org.dart;
import com.furd.Qwe;
public class Awe
{
public static void main(String[] args)
{
Qwe qwe = new Qwe();
qwe.getChanger();
}
}
Содержимое "module-info.java" из "Dart":
module org.dart {
requires com.furd;
}
Содержимое "pom.xml" из "Dart":
<?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>org.dart</groupId>
<artifactId>dart</artifactId>
<version>1.0.0</version>
<dependencies>
<dependency>
<groupId>com.furd</groupId>
<artifactId>furd</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<properties>
<maven.compiler.source>18</maven.compiler.source>
<maven.compiler.target>18</maven.compiler.target>
</properties>
</project>
Содержимое "module-info.java" из "Furd":
module com.furd {
exports com.furd;
}
Содержимое "Qwe.java" из "Furd":
package com.furd;
public class Qwe
{
public void getChanger()
{
System.out.println("change");
}
}
Содержимое "pom.xml" из "Furd":
<?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>com.furd</groupId>
<artifactId>furd</artifactId>
<version>1.0.0</version>
<properties>
<maven.compiler.source>18</maven.compiler.source>
<maven.compiler.target>18</maven.compiler.target>
</properties>
</project>
При компиляции получаю это:
/home/user/.jdks/openjdk-18.0.1.1/bin/java -javaagent:/snap/intellij-idea-community/372/lib/idea_rt.jar=45355:/snap/intellij-idea-community/372/bin -Dfile.encoding=UTF-8 -p /home/user/Projects/Java/Dart/target/classes:/home/user/Projects/Java/Furd/target/classes -m org.dart/org.dart.Awe Error occurred during initialization of boot layer java.lang.LayerInstantiationException: Package xxx in both module org.dart and module com.furd