【问题标题】:Execution failed for task ':spoon'. > org/eclipse/jdt/internal/core/util/CommentRecorderParser任务 ':spoon' 执行失败。 > org/eclipse/jdt/internal/core/util/CommentRecorderParser
【发布时间】:2017-07-28 19:58:58
【问题描述】:

我是 Spoon 的新手。我只知道使用 Spoon 我们可以分析和转换源代码。我想在我的 gradle 项目中使用 Spoon。我正在为这个项目使用 IntelliJ IDEA。我在尝试构建项目时收到此错误。

错误:

Execution failed for task ':spoon'.
> org/eclipse/jdt/internal/core/util/CommentRecorderParser

我的build.gradle文件如下:

group 'com.X'
version '1.0-SNAPSHOT'

apply plugin: 'java'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.12'
    compile 'fr.inria.gforge.spoon:spoon-core:5.8.0'
}

buildscript {
    repositories {
        mavenLocal()
        mavenCentral()
    }
    dependencies {
        classpath group: 'fr.inria.gforge.spoon',
                name: 'spoon-gradle-plugin',
                version:'1.1'
    }
}

apply plugin: 'java'
apply plugin: 'spoon'

jar {
    manifest {
        attributes(
                'Class-Path': configurations.compile.collect { it.getName() }.join(' '),
                'Main-Class': 'Main'
        )
    }
}

我在使用 --stacktrace 构建时得到了这个

Caused by: java.lang.NoClassDefFoundError: org/eclipse/jdt/internal/core/util/CommentRecorderParser

请帮我解决这个问题。在此先感谢

【问题讨论】:

    标签: java eclipse intellij-idea inria-spoon


    【解决方案1】:

    spoon 会发生这种情况,因为它无法在类路径中找到 org/eclipse/jdt/internal/core/util/CommentRecorderParser 类。将以下内容添加到您的 buildscript 依赖项中应该可以解决问题:

    buildscript {
    repositories {
        mavenLocal()
        mavenCentral()
    }
    dependencies {
        classpath group: 'fr.inria.gforge.spoon',
                name: 'spoon-gradle-plugin',
                version:'1.1'
        classpath group: 'org.eclipse.jdt', name: 'org.eclipse.jdt.core', version: '3.12.2'
    }
    

    }

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-07
      • 1970-01-01
      • 2023-03-15
      • 1970-01-01
      • 1970-01-01
      • 2018-07-18
      相关资源
      最近更新 更多