gradle - spring boot gradle文件中的 "tag::..."语法是什么?

标签 gradle spring-boot

使用 Spring Boot 和 Gradle 时,依赖项闭包中有一些注释,如“tag::jetty[]”和“end::jetty[]”。鉴于它们的语法,我假设它们是由 spring boot gradle 插件之类的东西解析的。这些有什么作用?他们是否需要让 Spring Boot 执行器和嵌入式码头工作?

sample 来自 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.



所以不,你不需要标签。它们仅用于在代码更改时自动更新指南的位。

关于gradle - spring boot gradle文件中的 "tag::..."语法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27924759/

相关文章:

java - 替换 Servlet Filter 中的响应内容

java - 使用 lib/as 依赖项中的所有 JAR 文件

spring-boot - springboot和cloud foundry如何禁用tomcat访问日志

java - 从IntelliJ运行时添加排除的Gradle依赖性

java - 使用 javafxplugin 和 hibernate 时无法在 IDE 外部运行 JavaFX 应用程序

java - 添加 Jasypt 加密依赖后 Springboot 应用程序性能受影响

java - Spring Boot - 使用 Gmail 发送电子邮件

spring-mvc - 将 Spring Data Rest 重新配置为第 1 页的索引

android - 是否可以在 Android Studio 中运行/调试测试?

android - build.gradle 文件构建有问题,未解决 'No such property error'