Spring Download Gradle Tomcat 8

The Spring Download Reference Guide provides instructions for upgrading to Tomcat 8 by setting a custom property in Maven:

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

What is the equivalent way to do the same in a Gradle assembly?

I tried the following to no avail. It remains in version 7.0.52 when the application starts.

 buildscript { ... ext['tomcat.version'] = '8.0.3' ... } 
+7
spring-boot tomcat gradle
source share
4 answers

Gradle does not have the equivalent of β€œparent pom,” so you must explicitly call the dependency. Because it is groovy, you can do it programmatically, something like:

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

We could add some support for version properties to the Spring Boot Gradle plugin (feel free to open the issue on github), but this should probably be optional.

+3
source share

Please look at the Gretty plugin: it supports Tomcat 8 (as well as Tomcat 7, Jetty 7/8/9) and SpringBoot out of the box. No need to configure dependencies.

https://github.com/akhikhl/gretty

Disclosure: I am the author of the Gretty plugin.

+3
source share

To configure tomcat version I used:

  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' } 

where you just need to find which spring-boot-starter-tomcat fits your needs

0
source share

Here's how I could configure Spring Boot1.3.3 to work with Tomcat v8.0.33. By default, it works with version 8.0.32, and this version has a problem with 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' 
0
source share

All Articles