Gradle
私は自分のアプリケーションを構築するために使用しspring-boot
ます。私が欲しいものは?
一部のモジュールがspring-boot
アプリケーションであるマルチモジュラー アプリケーションがあります。BOM
親プロジェクトのGradleファイルで春の依存関係を取得し、バージョンなしですべてのライブラリを使用したい.
これで、次の構成ができました。
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 依存関係管理プラグインを自動的に適用しなくなりました。代わりに、Spring Dependency Management プラグインが適用され、spring-boot-dependencies BOM (部品表) で構成されていることに反応します。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