2017-07-28 52 views
3

我是新来的勺子。我只知道使用Spoon我们可以分析和转换源代码。我想在我的gradle项目中使用勺子。我正在为这个项目使用IntelliJ IDEA。我在尝试构建项目时遇到此错误。任务'勺子'执行失败。 > org/eclipse/jdt/internal/core/util/CommentRecorderParser

错误:

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 

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

回答

1

这发生在勺子,因为它无法在类路径中找到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' 
} 

}

+0

非常感谢..它的工作.. – aravindkanna

相关问题