debugging - Gradle-Gradle 2.1的编译问题

标签 debugging compilation gradle option jacoco

我正在做从Gradle 1.6迁移到2.1的POC工作(基本上是为了解决此问题:Gradle build / test failed - kryo.KryoException: Buffer overflow)。

Gradle构建可与Gradle 1.6一起成功运行

使用Gradle 2.1,当我运行“gradle clean build”时,我收到以下错误消息。

FAILURE: Build failed with an exception.

* Where:
Initialization script '/production/gradle-2.1/init.d/extra1.common-thids.gradle' line: 19

* What went wrong:
Could not find property 'Compile' on root project 'Infrastructure'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED


:findbugsMain FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':findbugsMain'.
> The version of FindBugs (3.0.0) inferred from FindBugs classpath is too high to work with currently used Java version (1.6). Please use lower version of FindBugs or use newer version of Java. Inspected FindBugs classpath: [findbugs-3.0.0.jar, bcel-findbugs-6.0.jar, annotations-3.0.0.jar, jFormatString-3.0.0.jar, dom4j-1.6.1.jar, jaxen-1.1.6.jar, asm-debug-all-5.0.2.jar, commons-lang-2.6.jar, xml-apis-1.0.b2.jar]

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

全局级别的init.d / extra1 ...常见的gradle文件行是:我使用了相同的init.d文件(用于存储库设置和其他与Gradle 1.6一起使用的全局设置,该设置已应用了findbugs,pmd,java等插件等)。我将debug设置为true,以便jacoco可以产生代码覆盖率。知道吗,如何使用Gradle 2.1将选项debug设置为true?

对于findbugs问题,我不想将JAVA / JDK版本从1.6升级到1.7.0 40(当前,因为此核心项目的 Artifact 已被仍在JAVA JDK 1.6上的其他项目占用)。谢谢。
 18
 19    tasks.withType(Compile) {
 20      options.debug = true
 21      options.compilerArgs = ["-g"]
 22    }
 23

最佳答案

Compile重命名为JavaCompile。可以通过findbugs { toolVersion = "x.y.z" }配置要使用的FindBugs版本。

关于debugging - Gradle-Gradle 2.1的编译问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26790831/

相关文章:

c++ - 在移动的 lambda 中捕获和调试对局部变量引用的无效使用

c++ - CImg 的编译错误

javascript - 单击 ng 时附加模板

android - Gradle插件版本与Real Gradle版本Android Studio冲突

android - 更新 gradle 依赖项后 NavigationView 方法出错

java - 如何将一个简单的 Spring Boot(带有 Gradle 构建系统)部署到 Apache Tomcat(真实服务器,而非嵌入服务器)?

c++ - VS 2008 C++ 调试器只能工作一次

python - VS 代码中的外部终端调试器

objective-c - 在 xcode 中使用 try catch block 在真实设备上显示错误吗?

c# - 当只有一个具有给定名称的方法时,Visual Studio 指出存在不明确的调用