根目录中的build.gradle
//Applied to all projects.
allprojects {
apply plugin: 'eclipse'
apply plugin: 'idea'
group = 'de.test.platform'
version = '0.1'
}
subprojects {
//Currently all subprojects are also java projects. If this changes we
//need to move it into the corresponding projects
apply plugin: 'java'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenLocal()
mavenCentral()
}
idea {
module {
downloadSources = true
downloadJavadoc = false
}
}
}
idea {
project {
jdkName = '1.8'
languageLevel = '1.8'
}
}
子目录前端中的build.gradle(因此子项目称为:frontend)
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.5.RELEASE")
}
}
apply plugin: 'war'
apply plugin: 'spring-boot'
jar {
baseName = 'crowdio-frontend'
version = '0.1.0'
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
testCompile("junit:junit")
}
当我运行gradle bootRun并导航到http://localhost:8080/greeting时,如教程中我得到一个无限循环错误。如果我将模板从greeting.html更改为hello.html并在控制器greeting()操作中返回hello而不是greeting,则会出现404错误。
模板存储在project_root / frontend / src / main / resources / templates / greeting.html
中答案 0 :(得分:0)
看起来无论是什么原因,spring引导都可以使用gradle构建文件的精确结构来决定百万美元,就像在教程中一样。但是,如果切换到多项目设置,则需要添加
compile("org.thymeleaf:thymeleaf-spring4")
作为依赖。