2014-03-24 129 views
7

春季启动参考指南提供了一种通过在Maven中设置的自定义属性升级到Tomcat 8条指令:春季启动Tomcat的摇篮8

<properties> 
    <tomcat.version>8.0.3</tomcat.version> 
</properties> 

什么是等价的方式做同样的摇篮建?

我试过以下无济于事。它在应用程序启动时保持在7.0.52版本中。

buildscript { 
    ...  
    ext['tomcat.version'] = '8.0.3' 
    ... 
} 
+0

Spring Boot 1.2将默认使用tomcat 8。 https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-1.2-Release-Notes#servlet-31-tomcat-8-and-jetty-9 – TheKojuEffect

回答

3

Gradle没有等价的“父pom”,所以你必须显式地调用依赖。因为它是时髦,你也许可以做到这一点编程,像:

configurations.all { 
    resolutionStrategy.eachDependency { DependencyResolveDetails details -> 
    if (details.requested.group == 'org.apache.tomcat.embed') { 
     details.useVersion '8.0.3' 
    } 
    } 
} 

我们可以添加对版本属性春节引导摇篮插件(随意打开在github上一个问题)的一些支持,但它可能会必须是可选的。

3

请看Gretty插件:它支持Tomcat 8(以及Tomcat 7,Jetty 7/8/9)和SpringBoot开箱即用。不需要依赖性调整。

https://github.com/akhikhl/gretty

披露:我Gretty插件的作者。

0

有关设置Tomcat版本我用:

dependencies { 
    compile("org.springframework.boot:spring-boot-starter-web:${springBootVersion}") { 
     exclude module: "spring-boot-starter-tomcat" 
    } 
    compile 'org.springframework.boot:spring-boot-starter-tomcat:1.1.8.RELEASE' 
} 

,你只需要找到该弹簧引导起动tomcat的满足您的需求

0

这是我怎么可能配置Spring BOOT1。 3.3与Tomcat v8.0.33一起使用。默认情况下,它适用于8.0.32版,该版本有Websocket问题。

compile("org.springframework.boot:spring-boot-starter-web") { 
    exclude module: "spring-boot-starter-tomcat" 
    } 
    //providedRuntime("org.springframework.boot:spring-boot-starter-tomcat") 
    compile 'org.apache.tomcat.embed:tomcat-embed-core:8.0.33' 
    compile 'org.apache.tomcat.embed:tomcat-embed-el:8.0.33' 
    compile 'org.apache.tomcat.embed:tomcat-embed-logging-juli:8.0.33' 
    compile 'org.apache.tomcat.embed:tomcat-embed-websocket:8.0.33'