このバージョンはまだ開発中であり、まだ安定しているとは見なされていません。最新の安定バージョンについては、Spring Boot 3.5.4 を使用してください! |
入門
プラグインを開始するには、プロジェクトに適用する必要があります。
プラグインは Spring マイルストーンリポジトリに公開されます。Gradle はマイルストーンリポジトリを使用するように構成でき、プラグインは plugins
ブロックを使用して適用できます。マイルストーンリポジトリを使用するように Gradle を構成するには、settings.gradle
(Groovy)または settings.gradle.kts
(Kotlin)に以下を追加します。
Groovy
Kotlin
/*
* Copyright 2012-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
pluginManagement {
repositories {
maven {
url = 'https://repo.spring.io/milestone'
}
gradlePluginPortal()
}
}
pluginManagement {
repositories {
maven { url = uri("https://repo.spring.io/milestone") }
gradlePluginPortal()
}
}
その後、plugins
ブロックを使用してプラグインを適用できます。
Groovy
Kotlin
/*
* Copyright 2012-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
plugins {
id 'org.springframework.boot' version '4.0.0-M1'
}
plugins {
id("org.springframework.boot") version "4.0.0-M1"
}
プラグインを単独で適用すると、プロジェクトにいくつかの変更が加えられます。代わりに、プラグインは他の特定のプラグインが適用されたときにそれを検出し、それに応じて反応します。例: java
プラグインが適用されると、実行可能な jar を構築するためのタスクが自動的に構成されます。典型的な Spring Boot プロジェクトでは、groovy
(英語) 、java
(英語) 、org.jetbrains.kotlin.jvm
(英語) プラグインを最低限適用し、依存関係管理のために io.spring.dependency-management
[GitHub] (英語) プラグインまたは Gradle のネイティブ bom サポートも使用します。例:
Groovy
Kotlin
plugins {
id 'java'
id 'org.springframework.boot' version '4.0.0-M1'
}
apply plugin: 'io.spring.dependency-management'
plugins {
java
id("org.springframework.boot") version "4.0.0-M1"
}
apply(plugin = "io.spring.dependency-management")
他のプラグインが適用された場合の Spring Boot プラグインの動作の詳細については、「他のプラグインへの反応」のセクションを参照してください。