Java id为';雅科科';未找到+;格拉德尔

Java id为';雅科科';未找到+;格拉德尔,java,eclipse,groovy,gradle,jacoco,Java,Eclipse,Groovy,Gradle,Jacoco,我试图将jacoco支持添加到我的gradle项目中,但是当我添加jacoco插件时,它给了我一个错误 这是我的毕业设计 task wrapper(type: Wrapper) { gradleVersion = '1.11' } apply plugin: 'java' apply plugin: 'groovy' apply plugin: 'war' apply plugin: 'eclipse' apply plugin: 'eclipse-wtp' apply plugin: 'app

我试图将jacoco支持添加到我的gradle项目中,但是当我添加jacoco插件时,它给了我一个错误

这是我的毕业设计

task wrapper(type: Wrapper) { gradleVersion = '1.11' }
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'war'
apply plugin: 'eclipse'
apply plugin: 'eclipse-wtp'
apply plugin: 'application'
apply plugin: 'project-report'
apply plugin: 'jacoco'

eclipse {
  classpath { downloadSources=true }
}

eclipse.classpath.file {
  // Classpath entry for Eclipse which changes the order of classpathentries; otherwise no sources for 3rd party jars are shown
  withXml { xml ->
    def node = xml.asNode()
    node.remove( node.find { it.@path == 'org.eclipse.jst.j2ee.internal.web.container' } )
    node.appendNode( 'classpathentry', [ kind: 'con', path: 'org.eclipse.jst.j2ee.internal.web.container', exported: 'true'])
  }
}

tasks.withType(Compile) { options.encoding = 'UTF-8' }

repositories {
  mavenCentral()
  mavenLocal()
}

dependencies {
  providedCompile 'javax.servlet:servlet-api:2.5'
  runtime 'javax.servlet:jstl:1.1.2'

  compile 'org.springframework.batch:spring-batch-core:2.2.5.RELEASE'
  compile 'org.springframework:spring-webmvc:4.0.2.RELEASE'
  compile 'org.springframework:spring-jdbc:4.0.2.RELEASE'
  compile 'org.springframework:spring-orm:4.0.2.RELEASE'
  compile 'org.springframework.data:spring-data-mongodb:1.4.0.RELEASE'
  compile 'org.springframework.security:spring-security-web:3.2.1.RELEASE'
  compile 'org.springframework.security:spring-security-config:3.2.1.RELEASE'

  compile 'org.slf4j:slf4j-simple:1.6.1'
  compile 'org.codehaus.groovy:groovy-all:2.2.0'
  compile 'org.mongodb:mongo-java-driver:2.11.4'

  compile 'c3p0:c3p0:0.9.1.2'
  compile 'org.hibernate:hibernate-core:4.3.4.Final'
  compile 'org.hibernate:hibernate-ehcache:4.3.4.Final'
  compile 'org.hsqldb:hsqldb:2.0.0'

  compile 'com.google.guava:guava:16.0'
  compile 'commons-io:commons-io:2.4'

  compile 'com.google.code.gson:gson:2.2.4'
  compile 'org.codehaus.jackson:jackson-core-asl:1.9.13'
  compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'

  testCompile 'junit:junit:4.11'
  testCompile 'commons-collections:commons-collections:3.2'
  testCompile 'org.springframework:spring-test:4.0.2.RELEASE'
  testCompile 'org.codehaus.groovy:groovy-all:2.2.0'
  testCompile 'de.flapdoodle.embed:de.flapdoodle.embed.mongo:1.35'
  testCompile 'org.springframework.batch:spring-batch-test:2.2.5.RELEASE'

  compile localGroovy()
}

test {
  testLogging { // Show that tests are run in the command-line output
    events 'started', 'passed' }
  exclude 'com/bambilon/All*'
  exclude 'com/bambilon/**/slow/*'
}
当我在Eclipse中运行refresh dependencies时,会出现以下错误:

Caused by: org.gradle.api.plugins.UnknownPluginException: Plugin with id 'jacoco' not found.
    at org.gradle.api.internal.plugins.DefaultPluginRegistry.getTypeForId(DefaultPluginRegistry.java:86)
    at org.gradle.api.internal.plugins.DefaultProjectsPluginContainer.getTypeForId(DefaultProjectsPluginContainer.java:102)
    at org.gradle.api.internal.plugins.DefaultProjectsPluginContainer.apply(DefaultProjectsPluginContainer.java:37)
    at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyPlugin(DefaultObjectConfigurationAction.java:101)
    at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$200(DefaultObjectConfigurationAction.java:32)
    at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$3.run(DefaultObjectConfigurationAction.java:72)
    at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:114)
    at org.gradle.api.internal.project.AbstractProject.apply(AbstractProject.java:846)
    at org.gradle.api.Project$apply.call(Unknown Source)
    at org.gradle.api.internal.project.ProjectScript.apply(ProjectScript.groovy:34)
    at org.gradle.api.Script$apply.callCurrent(Unknown Source)

请帮忙,谢谢

我不太确定引入了哪个版本的
jacoco
插件,但使用Gradle 2.x它肯定能工作。如果在运行
gradle build
之后,您有一个
$buildDir/jacoco
文件夹,那么您可以确保它工作正常。关于的更多信息。

我也遇到了同样的问题,我在eclipse中设置了gradle路径。它为我解决了。设置路径

Eclipse-窗口->首选项类型Gardle


单击文件夹单选按钮,并设置系统中gradle文件夹的路径。

eclipse使用哪一版本的gradle?您好!我安装了2个版本1.10和1.11。我删除了1.10,并强制Eclipse使用1.11,而不是从build.gradle文件中获取它。它不再显示错误,尽管我不确定插件是否正常工作。谢谢你的帮助!