maven - Gradle 构建错误

标签 maven gradle

由于此错误,我的构建失败:

A problem occurred evaluating project ':DBSupport'. > Could not find method providedCompile() for arguments [project ':Core:Platform '] on 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. */
}

最佳答案

我认为这些模块实际上应该被视为已提供(例如,不应该是 WAR 存档中的包)。如果不只是将其更改为编译。
providedCompile Gradle 中没有开箱即用的配置。如果这是一个网络模块,你可以添加/应用一个 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它声称透明地做同样的事情。

关于maven - Gradle 构建错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21236931/

相关文章:

spring-boot - Maven vs.Gradle(范围)/ Spring 启动JUnit5

Gradle 尝试解压缩 pom 类型的依赖项

android - Gradle 错误 : Write access is allowed from event dispatch thread only in Android Studio

maven - 创建用于提交Spark应用程序的瘦 jar

eclipse - 在 Eclipse 中热部署时从依赖 jar 中找不到类

java - Maven:共享插件和配置文件构建插件中具有相同的artifactID

java - Maven 在构建时找不到我的测试测试类

gradle - 无法加载类 grails.plugins.rendering.image.ImageRenderingService Grails 4 渲染 :2. 03

android - 如何在android studio中的Android 5.0之前的手机上使用android-support-multidex.jar?

java - Eclipse Tomcat - 上下文环境变量