spring 引导 gradle 文件中的 "tag::..." 语法是什么?
What is the "tag::..." syntax for in a spring boot gradle file?
当使用 Spring Boot 和 Gradle 时,依赖闭包中有一些注释,如 "tag::jetty[]" 和 "end::jetty[]"。鉴于它们的语法,我假设它们是由 spring boot gradle 插件之类的东西解析的。这些有什么作用?他们是否需要让 spring 引导执行器和嵌入式码头工作?
来自下方 docs 的示例(参见依赖项闭包):
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.1.10.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
jar {
baseName = 'gs-spring-boot'
version = '0.1.0'
}
repositories {
mavenCentral()
}
dependencies {
// tag::jetty[]
compile("org.springframework.boot:spring-boot-starter-web") {
exclude module: "spring-boot-starter-tomcat"
}
compile("org.springframework.boot:spring-boot-starter-jetty")
// end::jetty[]
// tag::actuator[]
compile("org.springframework.boot:spring-boot-starter-actuator")
// end::actuator[]
testCompile("junit:junit")
}
task wrapper(type: Wrapper) {
gradleVersion = '1.11'
}
如底部所述Gradle Getting Started guide on spring.io:
Note: There are many start/end comments embedded here. This makes it possible to extract bits of the build file into this guide for the detailed explanations above. You don’t need them in your production build file.
所以不,您不需要标签。它们只是用于在代码更改时自动更新指南的位。
当使用 Spring Boot 和 Gradle 时,依赖闭包中有一些注释,如 "tag::jetty[]" 和 "end::jetty[]"。鉴于它们的语法,我假设它们是由 spring boot gradle 插件之类的东西解析的。这些有什么作用?他们是否需要让 spring 引导执行器和嵌入式码头工作?
来自下方 docs 的示例(参见依赖项闭包):
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.1.10.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
jar {
baseName = 'gs-spring-boot'
version = '0.1.0'
}
repositories {
mavenCentral()
}
dependencies {
// tag::jetty[]
compile("org.springframework.boot:spring-boot-starter-web") {
exclude module: "spring-boot-starter-tomcat"
}
compile("org.springframework.boot:spring-boot-starter-jetty")
// end::jetty[]
// tag::actuator[]
compile("org.springframework.boot:spring-boot-starter-actuator")
// end::actuator[]
testCompile("junit:junit")
}
task wrapper(type: Wrapper) {
gradleVersion = '1.11'
}
如底部所述Gradle Getting Started guide on spring.io:
Note: There are many start/end comments embedded here. This makes it possible to extract bits of the build file into this guide for the detailed explanations above. You don’t need them in your production build file.
所以不,您不需要标签。它们只是用于在代码更改时自动更新指南的位。