无法使用gradle

时间:2017-05-11 12:07:08

标签: java maven gradle spring-boot

我是较新的使用Gradle,我有这个文件build.gradle:

apply plugin: 'maven'
apply plugin: 'spring-boot'

group = "com.test.sample"
sourceCompatibility = 1.8
targetCompatibility = 1.8

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion")
        classpath 'io.spring.gradle:dependency-management-plugin:0.6.1.RELEASE'
    }
}

task wrapper(type: Wrapper) {
    gradleVersion = '2.0'
}

repositories {
     maven {
         credentials {
             username = nexusUsername
             password = nexusPassword
        }
        url "${nexusUrl}/content/repositories/releases/ex--common/"
        mavenCentral()
        jcenter()
        eventuateMavenRepoUrl.split(',').each { repoUrl -> maven { url repoUrl } }
    }
}

dependencies {
    compile "com.test.sample:EX--Common:${exCommonVersion}"
    compile "com.test.sample:EX--CommonSwagger:${exCommonSwaggerVersion}"

    compile("org.springframework.boot:spring-boot-devtools")

    compile "org.springframework.boot:spring-boot-starter-web:$springBootVersion"
    compile "org.springframework.boot:spring-boot-starter-actuator:$springBootVersion"

    compile "io.eventuate.local.java:eventuate-local-java-jdbc:${eventuateLocalVersion}"
    compile "io.eventuate.local.java:eventuate-local-java-embedded-cdc-autoconfigure:${eventuateLocalVersion}"

    testCompile "junit:junit:4.11"
    testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion"
    testCompile "io.eventuate.client.java:eventuate-client-java-jdbc:$eventuateClientVersion"
}

我在我的机器上安装了gradle 3.4.1。当我做的时候

gradle build

gradle assemble

我收到此错误:

  

无法应用插件[class'io.spring.gradle.dependencymanagement.DependencyManagementPlugin']   无法创建“DependencyManagementReportTask”类型的任务。

你有什么想法我可以解决这个问题吗?

这是堆栈跟踪信息:

* Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating project ':xxx'.
        at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:92)
        at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl$2.run(DefaultScriptPluginFactory.java:176)
        at org.gradle.configuration.ProjectScriptTarget.addConfiguration(ProjectScriptTarget.java:77)
        at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:181)
       .....
        at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:46)
Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin [id 'io.spring.dependency-management']
        at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:155)
        at org.gradle.api.internal.plugins.DefaultPluginManager.apply(DefaultPluginManager.java:112)
        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyType(DefaultObjectConfigurationAction.java:113)
        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$200(DefaultObjectConfigurationAction.java:36)
        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$3.run(DefaultObjectConfigurationAction.java:80)
        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:136)
        at org.gradle.api.internal.project.AbstractPluginAware.apply(AbstractPluginAware.java:44)
        at org.gradle.api.internal.project.ProjectScript.apply(ProjectScript.java:34)
        at org.gradle.api.Script$apply$0.callCurrent(Unknown Source)
        at build_cq297at3shymhbbwfq82eq5ag.run(C:\Users\xxx\build.gradle:13)
        at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:90)
        ... 62 more
Caused by: org.gradle.api.tasks.TaskInstantiationException: Could not create task of type 'DependencyManagementReportTask'.
        at org.gradle.api.internal.project.taskfactory.TaskFactory$1.call(TaskFactory.java:123)
        at org.gradle.api.internal.project.taskfactory.TaskFactory$1.call(TaskFactory.java:118)
        at org.gradle.util.GUtil.uncheckedCall(GUtil.java:402)
        at org.gradle.api.internal.AbstractTask.injectIntoNewInstance(AbstractTask.java:178)
        at org.gradle.api.internal.project.taskfactory.TaskFactory.create(TaskFactory.java:118)
        at org.gradle.api.internal.project.taskfactory.TaskFactory.createTask(TaskFactory.java:77)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory.createTask(AnnotationProcessingTaskFactory.java:46)
        at org.gradle.api.internal.project.taskfactory.DependencyAutoWireTaskFactory.createTask(DependencyAutoWireTaskFactory.java:39)
        at org.gradle.api.internal.tasks.DefaultTaskContainer.create(DefaultTaskContainer.java:76)
        at org.gradle.api.internal.tasks.DefaultTaskContainer.create(DefaultTaskContainer.java:111)
        at org.gradle.api.internal.tasks.DefaultTaskContainer.create(DefaultTaskContainer.java:141)
        at org.gradle.api.internal.tasks.DefaultTaskContainer_Decorated.create(Unknown Source)
        at org.gradle.api.internal.tasks.DefaultTaskContainer_Decorated$create.call(Unknown Source)
        at io.spring.gradle.dependencymanagement.DependencyManagementPlugin.apply(DependencyManagementPlugin.groovy:64)
        at io.spring.gradle.dependencymanagement.DependencyManagementPlugin.apply(DependencyManagementPlugin.groovy)
        at org.gradle.api.internal.plugins.ImperativeOnlyPluginApplicator.applyImperative(ImperativeOnlyPluginApplicator.java:35)
        at org.gradle.api.internal.plugins.RuleBasedPluginApplicator.applyImperative(RuleBasedPluginApplicator.java:43)
        at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:139)
        ... 72 more
Caused by: org.gradle.internal.service.UnknownServiceException: No service of type StyledTextOutputFactory available in ProjectScopeServices.
        at org.gradle.internal.service.DefaultServiceRegistry.getServiceProvider(DefaultServiceRegistry.java:436)
        at org.gradle.internal.service.DefaultServiceRegistry.doGet(DefaultServiceRegistry.java:426)
        at org.gradle.internal.service.DefaultServiceRegistry.get(DefaultServiceRegistry.java:414)
        at org.gradle.api.internal.DependencyInjectingInstantiator.convertParameters(DependencyInjectingInstantiator.java:81)
        at org.gradle.api.internal.DependencyInjectingInstantiator.newInstance(DependencyInjectingInstantiator.java:54)
        at org.gradle.api.internal.ClassGeneratorBackedInstantiator.newInstance(ClassGeneratorBackedInstantiator.java:36)
        at org.gradle.api.internal.project.taskfactory.TaskFactory$1.call(TaskFactory.java:121)
        ... 89 more

祝你好运

0 个答案:

没有答案