由于此错误,我的构建失败:
评估项目':DBSupport'时出现问题。 >找不到 方法provideCompile()用于参数[project':Core:Platform'] project':DBSupport'。
知道这意味着什么吗?
description = 'DBSupport main component of DBSupportTool'
dependencies {
providedCompile project(':Core:Platform')
providedCompile project(':Core:Verification')
providedCompile project(':DBSupportWeb')
providedCompile project(':DBSupportEJB')
compile(group: 'commons-lang', name: 'commons-lang', version:'1.0.1') {
/* This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. */
}
compile(group: 'commons-logging', name: 'commons-logging', version:'1.0.4') {
/* This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. */
}
compile(group: 'javax', name: 'j2ee', version:'1.0') {
/* This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. */
}
答案 0 :(得分:7)
我认为这些模块实际上应该按照提供的方式处理(例如,不应该是WAR存档中的包)。如果不只是将其更改为编译。
开箱即用的Gradle中没有 providedCompile
配置。如果这是一个Web模块,您只需添加/应用war插件:
apply plugin: 'war'
如果没有,您应该能够手动添加此配置:
configurations {
providedCompile
}
dependencies {
providedCompile project(':Core:Platform')
...
}
sourceSets.main.compileClasspath += configurations.providedCompile
sourceSets.test.compileClasspath += configurations.providedCompile
sourceSets.test.runtimeClasspath += configurations.providedCompile
还有一个propdeps-plugin声称透明地做同样的事情。
答案 1 :(得分:0)
要定义Maven中提供的依赖项,您需要采用以下方式:
project(':webgui') {
apply plugin: 'war'
dependencies {
compile project (':domain')
providedCompile 'javax:javaee-api:6.0'
}
}
或其他方式是project (module) like this:
dependencies {
compile module(":compile:1.0") {
dependency ":compile-transitive-1.0@jar"
dependency ":providedCompile-transitive:1.0@jar"
}
providedCompile "javax.servlet:servlet-api:2.5"
providedCompile module(":providedCompile:1.0") {
dependency ":providedCompile-transitive:1.0@jar"
}
runtime ":runtime:1.0"
providedRuntime ":providedRuntime:1.0@jar"
testCompile "junit:junit:4.11"
moreLibs ":otherLib:1.0"
}