Gradle spring boot 2 spring-boot-dependencies не может загрузить зависимости - PullRequest
0 голосов
/ 18 февраля 2019

Я использую eclipse 2018, gradle 5.2.1, buildship 3.0.1.

Моя конфигурация выглядит так:

enter image description here

Я пытаюсь создать загрузочную пружину 2 в соответствии с building-spring-boot-2-projects-with-gradle

build.gradle:

plugins {
    id 'java'
    id 'com.gradle.build-scan' version '2.1'
    id 'org.springframework.boot' version '2.1.3.RELEASE'
}

repositories {
    jCenter()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-dependencies:2.1.3.RELEASE'
    implementation 'org.springframework.boot:spring-boot-starter-web'

    testImplementation 'org.springframework.boot:spring-boot-starter-test'

    components {
        withModule('org.springframework:spring-beans') {
            allVariants {
                withDependencyConstraints {
                    // Need to patch constraints because snakeyaml is an optional dependency
                    it.findAll { it.name == 'snakeyaml' }.each { it.version { strictly '1.23' } }
                }
            }
        }
    }
}

buildScan {

    // always accept the terms of service
    termsOfServiceUrl = 'https://gradle.com/terms-of-service'
    termsOfServiceAgree = 'yes'

    // always publish a build scan
    publishAlways()
}

bootJar {
    mainClassName = 'gt4.App'
}

Однако после сохранения build.gradle проект и внешние зависимости исчезают, и банки с пружинной загрузкой тоже не загружаются.

enter image description here

В чем я был не прав?

Если я создаю проект весенней загрузки с gradle к Spring Tool Suite 4, сгенерированный build.gradle будет:

plugins {
    id 'org.springframework.boot' version '2.1.3.RELEASE'
    id 'java'
}

apply plugin: 'io.spring.dependency-management'

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

затемэто работает.

Я использую spring-boot-dependencies неправильно?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...