Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the "tag::..." syntax for in a spring boot gradle file?

When using Spring Boot and Gradle, there are some comments in the dependencies closure like "tag::jetty[]" and "end::jetty[]". Given the syntax of them, I assume they are parsed by something like the spring boot gradle plugin. What do these do? Are they required to get the spring boot actuator and embedded jetty to work?

Sample from docs below (see dependencies closure):

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'
}
like image 745
user605331 Avatar asked Jan 13 '15 14:01

user605331


1 Answers

As mentioned on the bottom of the 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.

So no, you don't need the tags. They're just for automatically updating bits of the guide when the code changes.

like image 72
Tom Verelst Avatar answered Oct 10 '22 02:10

Tom Verelst