入門

プラグインを開始するには、プロジェクトに適用する必要があります。

プラグインは Gradle のプラグインポータルに公開 (英語) され、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 '3.5.5'
}
plugins {
	id("org.springframework.boot") version "3.5.5"
}

プラグインを単独で適用すると、プロジェクトにいくつかの変更が加えられます。代わりに、プラグインは他の特定のプラグインが適用されたときにそれを検出し、それに応じて反応します。例: 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 '3.5.5'
}

apply plugin: 'io.spring.dependency-management'
plugins {
	java
	id("org.springframework.boot") version "3.5.5"
}

apply(plugin = "io.spring.dependency-management")

他のプラグインが適用された場合の Spring Boot プラグインの動作の詳細については、「他のプラグインへの反応」のセクションを参照してください。