2014-11-06 56 views
0

我正在做POC工作,從Gradle 1.6遷移到2.1(主要是爲了解決這個問題:Gradle build/test failed - kryo.KryoException: Buffer overflow)。Gradle - Gradle 2.1的編譯問題

搖籃打造的作品成功地與搖籃1.6

隨着搖籃2.1,當我運行「gradle這個乾淨的構建」,我得到了以下錯誤消息。

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?

對於FindBugs的問題,我不想(因爲這核心項目的構件是由仍然在JAVA JDK 1.6的其他項目中所消費的這段時間),以JAVA/JDK版本升級從1.6到1.7.0 40 。謝謝。

18 
19 tasks.withType(Compile) { 
20  options.debug = true 
21  options.compilerArgs = ["-g"] 
22 } 
23 

回答

3

Compile更名爲JavaCompile。要使用的FindBugs版本可以通過findbugs { toolVersion = "x.y.z" }進行配置。

+0

什麼是Groovy然後,GroovyCompile? – 2014-11-23 23:17:57

+0

是(請參閱[Gradle Build Language Reference](http://gradle.org/docs/current/dsl/index.html)或[Gradle用戶指南](http://gradle.org/docs/current/userguide /userguide_single.html))。 – 2014-11-23 23:23:07