我第一次尝试使用Eclipse2018-12导入XNAT的Gradle项目。我创建了这个项目,右键单击,选择了Gradle然后选择了现有的Gradle项目。导入完成后,SimpleUploadPlugin.java出现了一个错误--“无法解析org.apache.ecs.ConcreteElement类型。它是从所需的.class文件间接引用的”。我已经查过了,我有一个通用语言3-3.8.1.jar。
为了解决这个问题,我需要做些什么?
我的build.gradle依赖关系是:
// TODO: This is a pretty minimal set of dependencies, so don't worry if you need to add more.
dependencies {
implementation("org.nrg.xnat:web") {
transitive = false
}
implementation("org.nrg.xnat:xnat-data-models") {
transitive = false
}
implementation("org.nrg.xdat:core") {
transitive = false
}
implementation "org.nrg:prefs"
implementation "org.nrg:framework"
implementation("turbine:turbine") {
transitive = false
}
implementation("org.apache.velocity:velocity") {
transitive = false
}
implementation("stratum:stratum") {
transitive = false
}
implementation "log4j:log4j"
implementation "io.springfox:springfox-swagger2"
compile group: 'ecs', name: 'ecs', version: '1.4.2'
}发布于 2019-04-05 15:31:28
另一种选择是将org.nrg.xnat:web的依赖项配置从、编译或implementation更改为compileOnly。这使您可以为插件声明更少的依赖项,因为可以允许传递依赖项。ECS依赖项来自XNAT本身中的类,因此允许传递依赖意味着不必声明可能间接引用的所有内容。我刚刚在XNAT身份验证插件中做了这个更改,并从以下几个方面着手:
implementation("org.nrg.xnat:web") {
transitive = false
}
implementation("org.nrg.xnat:xnat-data-models") {
transitive = false
}
implementation("org.nrg.xdat:core") {
transitive = false
}
implementation("org.nrg:prefs") {
transitive = false
}
implementation("org.nrg:framework") {
transitive = false
}
implementation "org.springframework:spring-web"
implementation "org.springframework.security:spring-security-config"
implementation "org.springframework.security:spring-security-ldap"
implementation "org.apache.commons:commons-lang3"
implementation "org.hibernate.javax.persistence:hibernate-jpa-2.1-api"
implementation "com.google.guava:guava"
implementation "org.slf4j:slf4j-api"
implementation "log4j:log4j"
implementation "org.springframework.security:spring-security-web"
implementation "javax.servlet:javax.servlet-api"
compileOnly "com.google.code.findbugs:jsr305"
compileOnly "org.apache.ivy:ivy:2.4.0"
compileOnly("stratum:stratum") {
transitive = false
}对此:
compileOnly "org.nrg.xnat:web"
compileOnly "org.springframework.security:spring-security-ldap"
compileOnly "org.slf4j:slf4j-nop"如果你运行这个:
$ ./gradlew dependencies您将看到ecs:ecs:1.4.2通过许多传递依赖项被拉进来。
发布于 2019-04-05 06:14:33
org.apache.ecs.ConcreteElement来自Apache元素构造集(ECS),例如包含在ecs-1.4.2.jar中。
要解决此问题,请向build.gradle文件添加依赖项,如下所示:
// https://mvnrepository.com/artifact/ecs/ecs
compile group: 'ecs', name: 'ecs', version: '1.4.2'https://stackoverflow.com/questions/55525071
复制相似问题