由于缺少StyledTextOutputFactory,Spring-Boot 2在Gradle 4版本中失败,但为什么?

时间:2018-02-06 12:55:11

标签: java spring-boot gradle build

我尝试根据David Steiman的tutorial设置OAuth2授权服务器。目前,我想检查that solution是否仍适用于所包含库的大多数当前版本。仅在OAuth2ResourceServer子项目上工作,我更改了build.gradle中的相应条目,现在看起来像这样:

buildscript {
    ext {
        springBootVersion = '2.0.0.BUILD-SNAPSHOT'
    }
    repositories {
        mavenCentral()
        maven { url "http://repo.spring.io/snapshot" }
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot' 

jar {
    baseName = 'demo'
    version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
    mavenCentral()
}


dependencies {
    compile('org.springframework.boot:spring-boot-starter-web')
    compile('org.springframework.security.oauth:spring-security-oauth2:2.2.1.RELEASE')
    compile('org.springframework.security:spring-security-jwt:1.0.9.RELEASE')
    testCompile('org.springframework.boot:spring-boot-starter-test')
}


eclipse {
    classpath {
         containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER')
         containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8'
    }
}

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

实际上,起初,我尝试了Spring Boot版本1.5.10.RELEASE,它完全正常。但我需要使用Spring 5,因此需要使用Spring Boot 2.但是使用2.0.0.BUILD-SNAPSHOT,Spring引导Gradle插件告诉我必须至少使用Gradle 4.0,所以我不能使用随附的Gradle包装器示例项目。我在我的系统上安装了4.2.1版本,但也尝试使用4.5.1。使用Gradle 4时得到的是:

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Users\stefa\Projekte\spring-cloud-oauth2-example\OAuth2ResourceServer\build.gradle' line: 16

* What went wrong:
A problem occurred evaluating project ':OAuth2ResourceServer'.
> Failed to apply plugin [class 'io.spring.gradle.dependencymanagement.DependencyManagementPlugin']
> Could not create task of type 'DependencyManagementReportTask'.

相应堆栈跟踪的根本原因是:

...
Caused by: org.gradle.internal.service.UnknownServiceException: No service of type StyledTextOutputFactory available in ProjectScopeServices.
    at org.gradle.internal.service.DefaultServiceRegistry.get(DefaultServiceRegistry.java:324)
    at org.gradle.api.internal.DependencyInjectingInstantiator.convertParameters(DependencyInjectingInstantiator.java:110)
    at org.gradle.api.internal.DependencyInjectingInstantiator.newInstance(DependencyInjectingInstantiator.java:79)
    at org.gradle.api.internal.project.taskfactory.TaskFactory$1.call(TaskFactory.java:119)
    ... 144 more

导致我(在其他地方)there。据我所知,我正在使用的版本不应该有问题。但让我感到困惑的是,我实际上在我的"真实"中使用了Spring Boot 2.0.0.BUILD-SNAPSHOT和Gradle 4.5.1。项目,它在那里工作得很好。

我创建了一个使用Spring-Boot 2和Grade 4的example-project,效果非常好。我错过了什么?

0 个答案:

没有答案