您的位置:首页 > 编程语言 > Java开发

gradle 中指定 spring boot 的 thymeleaf 的版本

2017-11-01 00:00 232 查看
实际上下面这两行

ext['thymeleaf.version'] = '3.0.2.RELEASE'
ext['thymeleaf-layout-dialect.version'] = '2.1.1'

build.gradle 配置如下:

configurations {
providedRuntime
}

/**
配置这两个属性使用新版的 thymeleaf 而不是默认的  2.1
官方说明(但未说明Gradle如何配置):http://docs.spring.io/spring-boot/docs/1.5.4.RELEASE/reference/htmlsingle/#howto-use-thymeleaf-3
Gradle 配置方式 参考:https://github.com/spring-projects/spring-boot/issues/4393
*/
ext['thymeleaf.version'] = '3.0.2.RELEASE'
ext['thymeleaf-layout-dialect.version'] = '2.1.1'
ext['environment'] = System.getProperty("env", "dev")// 运行和打包的环境选择, 默认是开发环境 ,获取 gradle 参数中 -Dprofile 的值: gradle -Denv=production clean build

dependencies {
compile 'org.springframework.boot:spring-boot-devtools'
compile('org.springframework.boot:spring-boot-starter-aop')
compile('org.springframework.boot:spring-boot-starter-cache')
//compile('org.springframework.boot:spring-boot-starter-jdbc')
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-jersey')
compile('org.mybatis.spring.boot:mybatis-spring-boot-starter:1.3.0')
//compile('org.springframework.boot:spring-boot-starter-security')
compile('org.springframework.boot:spring-boot-starter-thymeleaf')
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-web-services')
//compile('org.springframework.boot:spring-boot-starter-tomcat')
compile('org.springframework.boot:spring-boot-starter-undertow')
compile('mysql:mysql-connector-java')
compile('com.alibaba:druid:1.0.25')
compile('org.apache.commons:commons-lang3:3.4')
compile('org.apache.poi:poi:3.9')
compile('org.apache.poi:poi-ooxml:3.9')
compile('org.bitbucket.b_c:jose4j:0.5.1')
compile('org.apache.httpcomponents:httpclient:4.5.2')
compile('org.apache.httpcomponents:httpmime')
compile('com.belerweb:pinyin4j:2.5.0')
compile('org.apache.axis2:axis2-kernel:1.7.4')
compile('org.apache.axis2:axis2-adb:1.2')
compile('net.sf.json-lib:json-lib:2.4:jdk15')
compile('com.google.guava:guava:18.0')
compile('com.thoughtworks.xstream:xstream:1.4.2')
//compile('javax.persistence:persistence-api:1.0.2')
//spring-shiro setting start
compile('org.apache.shiro:shiro-core:1.2.2')
compile('org.apache.shiro:shiro-spring:1.2.2')
compile('org.apache.shiro:shiro-ehcache:1.2.2')
//spring-shiro setting end
compile fileTree(dir:'libs',include:'*.jar')
//compile('org.springframework:springloaded:1.2.7.RELEASE')
//providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
//providedRuntime('org.springframework.boot:spring-boot-starter-undertow') //打war包设置
runtime('org.springframework.boot:spring-boot-starter-undertow') //打jar包需要设置为runtime
testCompile('org.springframework.boot:spring-boot-starter-test')
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息