Java eclipselibgdx项目可以';无法解决本地回购的梯度依赖关系,但CLI没有问题?
我正在尝试一个libgdx项目,它依赖于在本地repo中使用maven publish发布的lib:Java eclipselibgdx项目可以';无法解决本地回购的梯度依赖关系,但CLI没有问题?,java,eclipse,gradle,libgdx,Java,Eclipse,Gradle,Libgdx,我正在尝试一个libgdx项目,它依赖于在本地repo中使用maven publish发布的lib: // to publish locally: // ~/gdx-gltf$ ./gradlew gltf:publishToMavenLocal apply plugin: 'maven-publish' publishing { publications { mavenJava(MavenPublication) { groupId = 'io.
// to publish locally:
// ~/gdx-gltf$ ./gradlew gltf:publishToMavenLocal
apply plugin: 'maven-publish'
publishing {
publications {
mavenJava(MavenPublication) {
groupId = 'io.github.odys-z'
artifactId = 'gdx-gltf'
version = '0.1.0-SNAPSHOT'
from components.java
}
}
}
当我使用gradlew CLI运行桌面时,它正在工作:
./gradlew desktop:run
但在eclipse中,右键单击BasicTweenTest类(gradle project.ext.mainClassName)并作为java应用程序运行,eclipse报告了错误:
com.badlogic.gdx.utils.GdxRuntimeException: java.lang.Error: Unresolved compilation problems:
sceneAsset cannot be resolved to a variable
GLTFLoader cannot be resolved to a type
SceneModel cannot be resolved to a type
scenes cannot be resolved or is not a field
animationLoader cannot be resolved to a variable
缺少的类型位于本地回购依赖项gdx-gltf-0.1.0-SNAPSHOT中。无论我清理了什么项目或刷新了gradle,都会出现持续错误
桌面/build.gradle:
apply plugin: "java"
sourceCompatibility = 1.8
sourceSets.main.java.srcDirs = [ "src/", "test/" ]
sourceSets.main.resources.srcDirs = ["../android/assets", "test"]
// project.ext.mainClassName = "io.oz.wnw.norm.desktop.DesktopLauncher"
// project.ext.mainClassName = "io.oz.wnw.norm.desktop.PlaneStarTest"
project.ext.mainClassName = "io.oz.wnw.norm.desktop.BasicTweenTest"
project.ext.assetsDir = new File("../android/assets")
task run(dependsOn: classes, type: JavaExec) {
main = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
workingDir = project.assetsDir
ignoreExitValue = true
}
task debug(dependsOn: classes, type: JavaExec) {
main = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
workingDir = project.assetsDir
ignoreExitValue = true
debug = true
}
task dist(type: Jar) {
manifest {
attributes 'Main-Class': project.mainClassName
}
from {
configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
with jar
}
dist.dependsOn classes
上面注释掉的另外两个测试可以在CLI和eclipse中运行,这不依赖于本地发布的包。有什么想法吗
---------父项目/build.gradle----------
我也面临同样的问题。事实证明,上面编译的任何版本都不起作用 在本地发布之前,您需要强制java以1.7版编译
apply plugin: 'java'
sourceCompatibility = 1.7
targetCompatibility = 1.7
对于那些为类似问题苦苦挣扎的人来说,这里有一个简单介绍:只需根据本地发布的包
右键单击core->properties->java build path->source->link source
在核心项目中添加一个源代码链接,但我希望有人能深入研究问题的根源。
apply plugin: 'java'
sourceCompatibility = 1.7
targetCompatibility = 1.7