入門
要開始使用該外掛,需要將其應用到你的專案中。
該外掛已釋出到 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 '4.0.0'
}
plugins {
id("org.springframework.boot") version "4.0.0"
}
單獨應用時,該外掛對專案進行的更改很少。相反,該外掛會檢測何時應用了某些其他外掛並相應地做出反應。例如,當應用 java 外掛時,會自動配置一個用於構建可執行 jar 的任務。一個典型的 Spring Boot 專案至少會應用 groovy、java 或 org.jetbrains.kotlin.jvm 外掛,並且還會使用 io.spring.dependency-management 外掛或 Gradle 的原生 BOM 支援進行依賴管理。例如
-
Groovy
-
Kotlin
plugins {
id 'java'
id 'org.springframework.boot' version '4.0.0'
}
apply plugin: 'io.spring.dependency-management'
plugins {
java
id("org.springframework.boot") version "4.0.0"
}
apply(plugin = "io.spring.dependency-management")
要了解有關 Spring Boot 外掛在應用其他外掛時的行為的更多資訊,請參閱對其他外掛的反應部分。