我Gradle
用来构建我的spring-boot
应用程序。我想要什么?
我有一个多模块应用程序,其中一些模块是spring-boot
应用程序。我想BOM
在父项目的 Gradle 文件中获取 spring 依赖项并使用所有没有版本的库。
现在我有了下一个配置:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
我在每个模块中复制了这段代码。我阅读Gradle
了文档并看到了这个:
插件本身不再自动应用 Spring Dependency Management 插件。相反,它确实对使用 spring-boot-dependencies BOM 应用和配置的 Spring Dependency Management 插件做出反应(材料清单。我们将在本文后面详细介绍 BOM 支持。)
下面是一个例子:
plugins {
id 'java'
id 'com.gradle.build-scan' version '1.16'
id 'org.springframework.boot' version '2.0.5.RELEASE'
}
dependencies {
implementation 'org.springframework.boot:spring-boot-dependencies:2.0.5.RELEASE'
...
我很困惑。什么变种更好?我尝试像此文档一样更改我的代码,但出现错误:
> Could not resolve all files for configuration ':my-server:compileClasspath'.
> Could not find org.springframework.boot:spring-boot-starter-data-jpa:.
Required by:
project :my-server
> Could not find org.springframework.boot:spring-boot-starter-cache:.
Required by:
project :my-server
> Could not find org.springframework.boot:spring-boot-configuration-processor:.
Required by:
project :my-server
> Could not find org.hibernate:hibernate-jpamodelgen:.
Required by:
project :my-server
> Could not find org.projectlombok:lombok:.
Required by:
project :my-server
> Could not find org.springframework.kafka:spring-kafka:.
Required by:
project :my-server