Gradle:CompileTestJava因内部Java 8错误而失败

时间:2019-01-16 10:15:39

标签: gradle java-8 build.gradle

compileTestJava失败 编译器中发生了异常((版本信息不可用))。检查错误数据库(http://bugreport.java.com)是否重复后,请通过Java错误报告页面(http://bugs.java.com)针对Java编译器提交错误。在报告中包括您的程序和以下诊断。谢谢。

  

java.lang.NoClassDefFoundError:   com / sun / tools / javac / comp / LambdaToMethod $ 1LambdaBodyTranslator           在com.sun.tools.javac.comp.LambdaToMethod.makeLambdaStatementBody(LambdaToMethod.java:575)           在com.sun.tools.javac.comp.LambdaToMethod.makeLambdaBody(LambdaToMethod.java:502)           在com.sun.tools.javac.comp.LambdaToMethod.visitLambda(LambdaToMethod.java:308)           在com.sun.tools.javac.tree.JCTree $ JCLambda.accept(JCTree.java:1624)           在com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)           在com.sun.tools.javac.comp.LambdaToMethod.translate(LambdaToMethod.java:197)           在com.sun.tools.javac.comp.LambdaToMethod.translate(LambdaToMethod.java:190)           在com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:70)           在com.sun.tools.javac.tree.TreeTranslator.visitApply(TreeTranslator.java:275)           在com.sun.tools.javac.tree.JCTree $ JCMethodInvocation.accept(JCTree.java:1465)           在com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)           在com.sun.tools.javac.comp.LambdaToMethod.translate(LambdaToMethod.java:197)           在com.sun.tools.javac.comp.LambdaToMethod.translate(LambdaToMethod.java:190)           在com.sun.tools.javac.tree.TreeTranslator.visitExec(TreeTranslator.java:245)           在com.sun.tools.javac.tree.JCTree $ JCExpressionStatement.accept(JCTree.java:1296)           在com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)           在com.sun.tools.javac.comp.LambdaToMethod.translate(LambdaToMethod.java:197)           在com.sun.tools.javac.comp.LambdaToMethod.translate(LambdaToMethod.java:190)           在com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:70)           在com.sun.tools.javac.tree.TreeTranslator.visitBlock(TreeTranslator.java:162)           在com.sun.tools.javac.tree.JCTree $ JCBlock.accept(JCTree.java:909)           在com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)           在com.sun.tools.javac.comp.LambdaToMethod.translate(LambdaToMethod.java:197)           在com.sun.tools.javac.comp.LambdaToMethod.translate(LambdaToMethod.java:190)           在com.sun.tools.javac.tree.TreeTranslator.visitMethodDef(TreeTranslator.java:145)           在com.sun.tools.javac.tree.JCTree $ JCMethodDecl.accept(JCTree.java:778)           在com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)           在com.sun.tools.javac.comp.LambdaToMethod.translate(LambdaToMethod.java:197)           在com.sun.tools.javac.comp.LambdaToMethod.translate(LambdaToMethod.java:190)           在com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:70)           在com.sun.tools.javac.tree.TreeTranslator.visitClassDef(TreeTranslator.java:134)           在com.sun.tools.javac.comp.LambdaToMethod.visitClassDef(LambdaToMethod.java:237)           在com.sun.tools.javac.tree.JCTree $ JCClassDecl.accept(JCTree.java:693)           在com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)           在com.sun.tools.javac.comp.LambdaToMethod.translate(LambdaToMethod.java:197)           在com.sun.tools.javac.comp.LambdaToMethod.translate(LambdaToMethod.java:190)           在com.sun.tools.javac.comp.LambdaToMethod.translateTopLevelClass(LambdaToMethod.java:217)           在com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1493)           在com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1356)           在com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:901)           在com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:860)           在com.sun.tools.javac.main.Main.compile(Main.java:523)           在com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129)           在com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138)           在org.gradle.api.internal.tasks.compile.AnnotationProcessingCompileTask.call(AnnotationProcessingCompileTask.java:89)           在org.gradle.api.internal.tasks.compile.ResourceCleaningCompilationTask.call上

我试图从Maven迁移到gradle,我先运行gradle init,然后在运行gradle build时遇到了子项目错误

父build.gradle

allprojects  {
     apply plugin: 'maven'
}

subprojects {
apply plugin: 'java'
sourceCompatibility = 1.8
targetCompatibility = 1.8
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}

task packageSources(type: Jar) {
  classifier = 'sources'
  from sourceSets.main.allSource
}
artifacts.archives packageSources
  repositories {
    mavenLocal()
     maven { url "http://repo.maven.apache.org/maven2" }
 maven { url "https://plugins.gradle.org/m2/"}
}


configurations.all {
}
dependencies {
 testCompile group: 'junit', name: 'junit', version:'4.12'
 testCompile group: 'org.mockito', name: 'mockito-core', version:'2.2.15'
}


}

子build.gradle

 description = 'mapper'
 dependencies {
  compile group: 'com.dev.platform.web.api', name: 'json-structure', 
  version:'5.0.105-master'
  compile group: 'com.dev.services', name: 'platform-dao', 
  version:'6.1.165-master'
  compile(group: 'com.dev.services', name: 'platform-model', 
  version:'6.1.165-master') {
   exclude(module: 'log4j')
}
 testCompile(group: 'com.dev', name: 'platform-common',version:'1.0.24- 
 master') {
 exclude(module: 'platform-api')
}
 testCompile group: 'commons-io', name: 'commons-io', version:'2.2'
 }

task packageTests(type: Jar) {
 from sourceSets.test.output
  classifier = 'tests'
}
artifacts.archives packageTests

0 个答案:

没有答案