【问题标题】:What is the "tag::..." syntax for in a spring boot gradle file?spring boot gradle 文件中的“tag::...”语法是什么?
【发布时间】:2015-03-11 13:31:19
【问题描述】:

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

来自下面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 spring-boot


    【解决方案1】:

    正如Gradle Getting Started guide on spring.io底部提到的:

    注意:这里嵌入了许多开始/结束 cmets。这使得可以将构建文件的部分内容提取到本指南中以获取上述详细说明。在生产构建文件中不需要它们。

    所以不,你不需要标签。它们只是用于在代码更改时自动更新指南的部分内容。

    【讨论】:

      猜你喜欢
      • 2018-05-31
      • 2020-10-04
      • 2019-12-04
      • 1970-01-01
      • 2020-05-25
      • 2018-09-20
      • 2019-01-13
      • 2018-12-19
      • 1970-01-01
      相关资源
      最近更新 更多