我在尝试运行多模块 gradle 构建时遇到以下错误:
/Users/ashley/Personal/juggernaut/display/src/main/java/module-info.java:2: error: module not found: org.lwjgl.natives
requires org.lwjgl.natives;
^
/Users/ashley/Personal/juggernaut/display/src/main/java/module-info.java:3: error: module not found: org.lwjgl.glfw.natives
requires org.lwjgl.glfw.natives;
^
/Users/ashley/Personal/juggernaut/display/src/main/java/module-info.java:4: error: module not found: org.lwjgl.opengl.natives
requires org.lwjgl.opengl.natives;
^
/Users/ashley/Personal/juggernaut/display/src/main/java/module-info.java:5: error: module not found: org.lwjgl.stb.natives
requires org.lwjgl.stb.natives;
^
/Users/ashley/Personal/juggernaut/display/src/main/java/module-info.java:6: error: module not found: org.lwjgl.assimp.natives
requires org.lwjgl.assimp.natives;
我的项目结构如下:
├── build.gradle
├── display
│ ├── build.gradle
│ └── src
│ └── main
│ ├── java
│ │ ├── module-info.java
├── engine
│ ├── build.gradle
│ └── src
│ └── main
│ ├── java
│ │ ├── module-info.java
└── settings.gradle
module-info.java
for需要必要的display
LWJGL3 模块:
module uk.ashleybye.juggernaut.display {
requires org.lwjgl.natives;
requires org.lwjgl.glfw.natives;
requires org.lwjgl.opengl.natives;
requires org.lwjgl.stb.natives;
requires org.lwjgl.assimp.natives;
exports uk.ashleybye.juggernaut.display;
}
相关依赖项包含在build.gradle
:
project.ext.lwjglVersion = "3.2.2"
project.ext.lwjglNatives = "natives-macos"
dependencies {
implementation "org.lwjgl:lwjgl:$lwjglVersion"
implementation "org.lwjgl:lwjgl-assimp:$lwjglVersion"
implementation "org.lwjgl:lwjgl-glfw:$lwjglVersion"
implementation "org.lwjgl:lwjgl-openal:$lwjglVersion"
implementation "org.lwjgl:lwjgl-opengl:$lwjglVersion"
implementation "org.lwjgl:lwjgl-stb:$lwjglVersion"
runtimeOnly "org.lwjgl:lwjgl:$lwjglVersion:$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-assimp:$lwjglVersion:$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-glfw:$lwjglVersion:$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-openal:$lwjglVersion:$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-opengl:$lwjglVersion:$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-stb:$lwjglVersion:$lwjglNatives"
}
引擎requires uk.ashleybye.juggernaut.display;
并具有实现依赖项:implementation project(":display")
.
我的版本信息:
./gradlew --version Sat 17 Aug 09:31:44 2019
------------------------------------------------------------
Gradle 5.5.1
------------------------------------------------------------
Build time: 2019-07-10 20:38:12 UTC
Revision: 3245f748c7061472da4dc184991919810f7935a5
Kotlin: 1.3.31
Groovy: 2.5.4
Ant: Apache Ant(TM) version 1.9.14 compiled on March 12 2019
JVM: 12 (Oracle Corporation 12+33)
OS: Mac OS X 10.14.6 x86_64
为什么gradle找不到模块?