这真的很折磨我。
我正在使用 Gradle 编译 Java/Groovy 项目。 在 :compileGroovy 任务期间,我收到 StackOverflowError。
堆栈跟踪如下所示:
Caused by: org.gradle.api.GradleException: Could not call GroovyCompile.compile() on task ':compileGroovy'
at org.gradle.util.JavaMethod.invoke(JavaMethod.java:69)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:219)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:212)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:201)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:527)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:510)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 53 more
Caused by: java.lang.StackOverflowError
at java.util.HashMap.containsKey(HashMap.java:434)
at java.util.HashSet.contains(HashSet.java:201)
at org.codehaus.groovy.ast.GenericsType.genericsBounds(GenericsType.java:114)
at org.codehaus.groovy.ast.GenericsType.genericsBounds(GenericsType.java:92)
at org.codehaus.groovy.ast.GenericsType.toString(GenericsType.java:73)
at org.codehaus.groovy.ast.GenericsType.genericsBounds(GenericsType.java:118)
at org.codehaus.groovy.ast.GenericsType.genericsBounds(GenericsType.java:92)
at org.codehaus.groovy.ast.GenericsType.toString(GenericsType.java:73)
at org.codehaus.groovy.ast.GenericsType.genericsBounds(GenericsType.java:118)
at org.codehaus.groovy.ast.GenericsType.genericsBounds(GenericsType.java:92)
at org.codehaus.groovy.ast.GenericsType.toString(GenericsType.java:73)
at org.codehaus.groovy.ast.GenericsType.genericsBounds(GenericsType.java:118)
at org.codehaus.groovy.ast.GenericsType.genericsBounds(GenericsType.java:92)
at org.codehaus.groovy.ast.GenericsType.toString(GenericsType.java:73)
我正在使用: 等级:1.8 常规:2.1.1
我尝试在 GenericsType 类中放置断点,但由于某种原因它并没有就此停止。
我的 build.gradle 看起来像这样:
apply plugin: "java"
apply plugin: "idea"
apply plugin: "groovy"
apply plugin: "maven"
apply plugin: "application"
def organizationId = "sevenlights"
def projectSourceCompatibility = "1.6"
def projectTargetCompatibility = "1.6"
sourceCompatibility = projectSourceCompatibility
targetCompatibility = projectTargetCompatibility
version = "1.0"
group = "com.sevenlights"
description = "7lights"
def mavenArtifactId = "7lights"
def slf4jVersion = "1.6.4"
def groovyVersion = "2.1.1"
def springFrameworkVersion = "3.0.5.RELEASE"
def grailsVersion = "2.2.2"
def gormVersion = "1.3.7"
def junitVersion = "4.11"
repositories {
mavenCentral()
mavenLocal()
maven { url "http://repo.grails.org/grails/core/" }
maven { url "http://repository.codehaus.org" }
maven { url "http://snapshots.repository.codehaus.org" }
}
dependencies {
compile ("org.slf4j:slf4j-api:${slf4jVersion}",
"org.slf4j:slf4j-log4j12:${slf4jVersion}",
"log4j:log4j:1.2.14",
"org.codehaus.groovy:groovy-all:${groovyVersion}",
"org.grails:grails-gorm:${gormVersion}",
"org.grails:grails-core:${grailsVersion}",
"org.grails:grails-spring:${grailsVersion}",
"org.grails:grails-bootstrap:${grailsVersion}",
'com.h2database:h2:1.3.170',
"org.springframework:spring-context:${springFrameworkVersion}",
"org.springframework:spring-core:${springFrameworkVersion}",
"org.springframework:spring-context-support:${springFrameworkVersion}",
"org.springframework:spring-orm:${springFrameworkVersion}",
"org.springframework:spring-aop:${springFrameworkVersion}",
"org.springframework:spring-core:${springFrameworkVersion}",
"mysql:mysql-connector-java:5.1.22",
"joda-time:joda-time:2.2",
"com.google.code.gson:gson:1.7.1",
"org.jsoup:jsoup:1.7.2",
"org.ccil.cowan.tagsoup:tagsoup:1.2",
"org.grails:grails-test:1.3.6",
"org.jadira.usertype:usertype.jodatime:1.9"
)
compile("org.codehaus.groovy.modules.http-builder:http-builder:0.7-SNAPSHOT") {
exclude group: "org.codehaus.groovy", module:'groovy'
}
compile("org.springframework.uaa:org.springframework.uaa.client:1.0.3.RELEASE") {
exclude group: "org.springframework.roo.wrapping", module:'*'
}
testCompile(
"junit:junit:${junitVersion}",
"org.easymock:easymock:3.2",
"org.jmock:jmock:2.6.0",
"org.jmock:jmock-junit4:2.6.0",
"org.jmock:jmock-legacy:2.6.0",
"cglib:cglib-nodep:2.1_3",
"org.objenesis:objenesis:1.0",
"org.hamcrest:hamcrest-integration:1.3",
"org.mockito:mockito-all:1.8.4",
"com.cyrusinnovation:mockito-groovy-support:1.2",
"org.jmock:jmock-junit4:2.6.0",
"org.spockframework:spock-core:0.7-groovy-2.0"
)
}
task wrapper(type: Wrapper, description: 'Generates the Gradle wrapper.') {
gradleVersion = '1.6'
jarFile = 'wrapper/wrapper.jar'
}
task myJar(type: Jar)
task copyToLib(type: Copy) {
into "$buildDir/libs"
from configurations.default
// from configurations.default.allArtifactFiles
}
artifacts {
archives myJar
}
我的完整依赖关系树如下所示:
compile - Compile classpath for source set 'main'.
+--- org.slf4j:slf4j-api:1.6.4
+--- org.slf4j:slf4j-log4j12:1.6.4
| +--- org.slf4j:slf4j-api:1.6.4
| \--- log4j:log4j:1.2.16
+--- log4j:log4j:1.2.14 -> 1.2.16
+--- org.codehaus.groovy:groovy-all:2.1.1
+--- org.grails:grails-gorm:1.3.7
| +--- commons-lang:commons-lang:2.4 -> 2.6
| +--- org.hibernate:hibernate-core:3.3.1.GA
| | +--- antlr:antlr:2.7.6
| | +--- commons-collections:commons-collections:3.1 -> 3.2.1
| | +--- dom4j:dom4j:1.6.1
| | | \--- xml-apis:xml-apis:1.0.b2 -> 1.3.04
| | +--- javax.transaction:jta:1.1
| | \--- org.slf4j:slf4j-api:1.5.2 -> 1.6.4
| +--- org.grails:grails-core:1.3.7 -> 2.2.2
| | +--- commons-collections:commons-collections:3.2.1
| | +--- commons-io:commons-io:2.1
| | +--- org.springframework:spring-context:3.1.4.RELEASE
| | | +--- org.springframework:spring-aop:3.1.4.RELEASE
| | | | +--- aopalliance:aopalliance:1.0
| | | | +--- org.springframework:spring-asm:3.1.4.RELEASE
| | | | +--- org.springframework:spring-beans:3.1.4.RELEASE
| | | | | \--- org.springframework:spring-core:3.1.4.RELEASE
| | | | | +--- org.springframework:spring-asm:3.1.4.RELEASE
| | | | | \--- commons-logging:commons-logging:1.1.1
| | | | \--- org.springframework:spring-core:3.1.4.RELEASE (*)
| | | +--- org.springframework:spring-beans:3.1.4.RELEASE (*)
| | | +--- org.springframework:spring-core:3.1.4.RELEASE (*)
| | | +--- org.springframework:spring-expression:3.1.4.RELEASE
| | | | \--- org.springframework:spring-core:3.1.4.RELEASE (*)
| | | \--- org.springframework:spring-asm:3.1.4.RELEASE
| | +--- com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.3.1
| | +--- oro:oro:2.0.8
| | +--- org.codehaus.groovy:groovy-all:2.0.8 -> 2.1.1
| | +--- xalan:serializer:2.7.1
| | +--- org.grails:grails:2.2.2
| | | +--- org.codehaus.groovy:groovy-all:2.0.8 -> 2.1.1
| | | +--- org.slf4j:jcl-over-slf4j:1.6.2
| | | | \--- org.slf4j:slf4j-api:1.6.2 -> 1.6.4
| | | +--- javax.servlet:javax.servlet-api:3.0.1
| | | +--- org.slf4j:slf4j-api:1.6.2 -> 1.6.4
| | | \--- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:1.0.1.Final
| | +--- org.springframework:spring-beans:3.1.4.RELEASE (*)
| | +--- org.springframework:spring-jms:3.1.4.RELEASE
| | | +--- aopalliance:aopalliance:1.0
| | | +--- org.springframework:spring-aop:3.1.4.RELEASE (*)
| | | +--- org.springframework:spring-beans:3.1.4.RELEASE (*)
| | | +--- org.springframework:spring-context:3.1.4.RELEASE (*)
| | | +--- org.springframework:spring-core:3.1.4.RELEASE (*)
| | | \--- org.springframework:spring-tx:3.1.4.RELEASE
| | | +--- aopalliance:aopalliance:1.0
| | | +--- org.springframework:spring-aop:3.1.4.RELEASE (*)
| | | +--- org.springframework:spring-beans:3.1.4.RELEASE (*)
| | | +--- org.springframework:spring-context:3.1.4.RELEASE (*)
| | | \--- org.springframework:spring-core:3.1.4.RELEASE (*)
| | +--- org.springframework:spring-tx:3.1.4.RELEASE (*)
| | +--- javax.servlet:javax.servlet-api:3.0.1
| | +--- org.aspectj:aspectjrt:1.6.10
| | +--- org.springframework:spring-aspects:3.1.4.RELEASE
| | | +--- org.springframework:spring-beans:3.1.4.RELEASE (*)
| | | +--- org.springframework:spring-context:3.1.4.RELEASE (*)
| | | \--- org.springframework:spring-context-support:3.1.4.RELEASE
| | | +--- org.springframework:spring-beans:3.1.4.RELEASE (*)
| | | +--- org.springframework:spring-context:3.1.4.RELEASE (*)
| | | \--- org.springframework:spring-core:3.1.4.RELEASE (*)
| | +--- org.slf4j:slf4j-api:1.6.2 -> 1.6.4
| | +--- org.springframework:spring-expression:3.1.4.RELEASE (*)
| | +--- org.springframework:spring-asm:3.1.4.RELEASE
| | +--- org.springframework:spring-context-support:3.1.4.RELEASE (*)
| | +--- org.grails:grails-bootstrap:2.2.2
| | | +--- jline:jline:1.0
| | | +--- org.fusesource.jansi:jansi:1.2.1
| | | +--- org.apache.ant:ant:1.8.2
| | | | \--- org.apache.ant:ant-launcher:1.8.2
| | | +--- org.codehaus.groovy:groovy-all:2.0.8 -> 2.1.1
| | | +--- org.slf4j:jcl-over-slf4j:1.6.2 (*)
| | | +--- org.apache.ant:ant-launcher:1.8.2
| | | +--- javax.servlet:javax.servlet-api:3.0.1
| | | +--- org.apache.ivy:ivy:2.2.0
| | | +--- org.slf4j:slf4j-api:1.6.2 -> 1.6.4
| | | +--- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:1.0.1.Final
| | | +--- org.apache.ant:ant-trax:1.7.1
| | | | \--- org.apache.ant:ant:1.7.1 -> 1.8.2 (*)
| | | +--- org.apache.ant:ant-junit:1.8.2
| | | | +--- org.apache.ant:ant:1.8.2 (*)
| | | | \--- junit:junit:3.8.2 -> 4.8.1
| | | +--- net.java.dev.jna:jna:3.2.3
| | | +--- org.springframework:spring-core:3.1.4.RELEASE (*)
| | | \--- org.codehaus.gant:gant_groovy1.8:1.9.6
| | | +--- org.apache.ant:ant:1.8.2 (*)
| | | \--- commons-cli:commons-cli:1.2
| | +--- org.aspectj:aspectjweaver:1.6.10
| | +--- org.springframework:spring-core:3.1.4.RELEASE (*)
| | +--- org.springframework:spring-web:3.1.4.RELEASE
| | | +--- aopalliance:aopalliance:1.0
| | | +--- org.springframework:spring-aop:3.1.4.RELEASE (*)
| | | +--- org.springframework:spring-beans:3.1.4.RELEASE (*)
| | | +--- org.springframework:spring-context:3.1.4.RELEASE (*)
| | | \--- org.springframework:spring-core:3.1.4.RELEASE (*)
| | +--- org.springframework:spring-test:3.1.4.RELEASE
| | +--- org.slf4j:jcl-over-slf4j:1.6.2 (*)
| | +--- asm:asm:3.1
| | +--- cglib:cglib:2.2
| | | \--- asm:asm:3.1
| | +--- aopalliance:aopalliance:1.0
| | +--- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:1.0.1.Final
| | +--- commons-validator:commons-validator:1.3.1
| | +--- org.springframework:spring-aop:3.1.4.RELEASE (*)
| | \--- commons-lang:commons-lang:2.6
| +--- org.springframework:spring-aop:3.0.5.RELEASE -> 3.1.4.RELEASE (*)
| +--- org.springframework:spring-beans:3.0.5.RELEASE -> 3.1.4.RELEASE (*)
| +--- org.springframework:spring-context:3.0.5.RELEASE -> 3.1.4.RELEASE (*)
| +--- org.springframework:spring-context-support:3.0.5.RELEASE -> 3.1.4.RELEASE (*)
| +--- org.springframework:spring-core:3.0.5.RELEASE -> 3.1.4.RELEASE (*)
| +--- org.springframework:spring-expression:3.0.5.RELEASE -> 3.1.4.RELEASE (*)
| +--- org.springframework:spring-instrument:3.0.5.RELEASE
| +--- org.springframework:spring-jdbc:3.0.5.RELEASE
| | +--- org.springframework:spring-beans:3.0.5.RELEASE -> 3.1.4.RELEASE (*)
| | +--- org.springframework:spring-core:3.0.5.RELEASE -> 3.1.4.RELEASE (*)
| | \--- org.springframework:spring-tx:3.0.5.RELEASE -> 3.1.4.RELEASE (*)
| +--- org.springframework:spring-orm:3.0.5.RELEASE
| | +--- org.springframework:spring-beans:3.0.5.RELEASE -> 3.1.4.RELEASE (*)
| | +--- org.springframework:spring-core:3.0.5.RELEASE -> 3.1.4.RELEASE (*)
| | +--- org.springframework:spring-jdbc:3.0.5.RELEASE (*)
| | \--- org.springframework:spring-tx:3.0.5.RELEASE -> 3.1.4.RELEASE (*)
| +--- org.springframework:spring-oxm:3.0.5.RELEASE
| | +--- org.springframework:spring-beans:3.0.5.RELEASE -> 3.1.4.RELEASE (*)
| | +--- org.springframework:spring-context:3.0.5.RELEASE -> 3.1.4.RELEASE (*)
| | \--- org.springframework:spring-core:3.0.5.RELEASE -> 3.1.4.RELEASE (*)
| +--- org.springframework:spring-tx:3.0.5.RELEASE -> 3.1.4.RELEASE (*)
| +--- org.hibernate:ejb3-persistence:1.0.2.GA
| +--- org.hibernate:hibernate-annotations:3.4.0.GA
| | +--- org.hibernate:ejb3-persistence:1.0.2.GA
| | +--- org.hibernate:hibernate-commons-annotations:3.1.0.GA
| | | \--- org.slf4j:slf4j-api:1.4.2 -> 1.6.4
| | +--- org.hibernate:hibernate-core:3.3.0.SP1 -> 3.3.1.GA (*)
| | +--- org.slf4j:slf4j-api:1.4.2 -> 1.6.4
| | \--- dom4j:dom4j:1.6.1 (*)
| +--- org.hibernate:hibernate-commons-annotations:3.1.0.GA (*)
| +--- javassist:javassist:3.11.0.GA
| +--- org.codehaus.groovy:groovy-all:1.7.8 -> 2.1.1
| +--- org.slf4j:jcl-over-slf4j:1.5.8 -> 1.6.2 (*)
| +--- org.slf4j:jul-to-slf4j:1.5.8
| | \--- org.slf4j:slf4j-api:1.5.8 -> 1.6.4
| \--- org.slf4j:slf4j-api:1.5.8 -> 1.6.4
+--- org.grails:grails-core:2.2.2 (*)
+--- org.grails:grails-spring:2.2.2
| +--- javax.servlet:javax.servlet-api:3.0.1
| +--- org.slf4j:slf4j-api:1.6.2 -> 1.6.4
| +--- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:1.0.1.Final
| +--- org.grails:grails-bootstrap:2.2.2 (*)
| +--- org.codehaus.groovy:groovy-all:2.0.8 -> 2.1.1
| +--- org.slf4j:jcl-over-slf4j:1.6.2 (*)
| +--- org.springframework:spring-web:3.1.4.RELEASE (*)
| \--- org.springframework:spring-tx:3.1.4.RELEASE (*)
+--- org.grails:grails-bootstrap:2.2.2 (*)
+--- com.h2database:h2:1.3.170
+--- org.springframework:spring-context:3.0.5.RELEASE -> 3.1.4.RELEASE (*)
+--- org.springframework:spring-core:3.0.5.RELEASE -> 3.1.4.RELEASE (*)
+--- org.springframework:spring-context-support:3.0.5.RELEASE -> 3.1.4.RELEASE (*)
+--- org.springframework:spring-orm:3.0.5.RELEASE (*)
+--- org.springframework:spring-aop:3.0.5.RELEASE -> 3.1.4.RELEASE (*)
+--- mysql:mysql-connector-java:5.1.22
+--- joda-time:joda-time:2.2
+--- com.google.code.gson:gson:1.7.1
+--- org.jsoup:jsoup:1.7.2
+--- org.ccil.cowan.tagsoup:tagsoup:1.2
+--- org.grails:grails-test:1.3.6
| +--- commons-lang:commons-lang:2.4 -> 2.6
| +--- org.springframework:spring-test:3.0.5.RELEASE -> 3.1.4.RELEASE
| +--- junit:junit:4.8.1
| +--- org.codehaus.groovy:groovy-all:1.7.5 -> 2.1.1
| +--- org.slf4j:jcl-over-slf4j:1.5.8 -> 1.6.2 (*)
| +--- org.slf4j:jul-to-slf4j:1.5.8 (*)
| \--- org.slf4j:slf4j-api:1.5.8 -> 1.6.4
+--- org.jadira.usertype:usertype.jodatime:1.9
| \--- org.jadira.usertype:usertype.spi:1.9
+--- org.codehaus.groovy.modules.http-builder:http-builder:0.7-SNAPSHOT
| +--- org.apache.httpcomponents:httpclient:4.2.1
| | +--- org.apache.httpcomponents:httpcore:4.2.1
| | +--- commons-logging:commons-logging:1.1.1
| | \--- commons-codec:commons-codec:1.6
| +--- net.sf.json-lib:json-lib:2.3
| | +--- commons-beanutils:commons-beanutils:1.8.0
| | | \--- commons-logging:commons-logging:1.1.1
| | +--- commons-collections:commons-collections:3.2.1
| | +--- commons-lang:commons-lang:2.4 -> 2.6
| | +--- commons-logging:commons-logging:1.1.1
| | \--- net.sf.ezmorph:ezmorph:1.0.6
| | \--- commons-lang:commons-lang:2.3 -> 2.6
| +--- net.sourceforge.nekohtml:nekohtml:1.9.16
| | \--- xerces:xercesImpl:2.9.1
| | \--- xml-apis:xml-apis:1.3.04
| \--- xml-resolver:xml-resolver:1.2
\--- org.springframework.uaa:org.springframework.uaa.client:1.0.3.RELEASE
任何帮助将非常感激。
看起来像是 Groovy 编译器错误。我建议尝试使用更新的 Groovy 版本(
2.1.7
或 2.2.0-beta-2
)。