Reputation: 731
I am fairly new to both Spring Boot and Gradle. In trying to simplify my build.gradle script, I came across the following problem. Since I'm using Gradle 2.5, I decided to take advantage of Gradle's new plugins DSL. Unfortunately, one of the plugins that I needed to use, the spring-boot-gradle-plugin
, was not included on the Gradle plugins portal. To work around that, I used the old buildscript {...}
, apply plugin:
syntax for that plugin and specified the rest of my plugins in the new plugins {...}
syntax. The result was the following build script:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath: "org.springframework.boot:spring-boot-gradle-plugin:1.3.2.RELEASE"
}
}
plugins {
id "io.spring.dependency-management" version "0.5.4.RELEASE"
id "java"
id "idea"
}
apply plugin: 'spring-boot'
repositories {
mavenCentral()
}
dependencyManagement {
imports {
mavenBom 'com.vaadin:vaadin-bom:7.6.1'
}
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-data-jpa")
compile("org.springframework.boot:spring-boot-starter-actuator")
compile("com.vaadin:vaadin-spring-boot-starter")
compile("com.h2database:h2")
testCompile("junit:junit")
}
jar {
baseName = 'my-spring-boot-app'
version = '0.1.0'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}
However, this build script does not work. When running gradle build
, I get the error Plugin with id 'spring-boot' not found.
Is this a consequence of trying to use these two syntaxes in conjunction, or am I just doing something silly?
Upvotes: 1
Views: 610
Reputation: 731
I was being silly. Syntax error on line 6. There shouldn't be a colon after classpath
.
Upvotes: 1