在Spring Boot Documentation中有一节使用带有Gradle的Tomcat 7.x或8.0 这对Maven很有用,如一些spring-boot-samples中所示,但遗憾的是不适用于Gradle.
有没有比从tomcat-starter中排除所有tomcat依赖项更简单的解决方案,并将它们与另一个版本分开添加?
重现:如果将示例项目spring-boot-sample-tomcat80-ssl转换为具有以下依赖项的Gradle项目:
dependencies {
compile("org.springframework.boot:spring-boot-starter:1.4.2.RELEASE")
compile("org.springframework.boot:spring-boot-starter-tomcat:1.4.2.RELEASE")
compile("org.springframework:spring-webmvc:4.3.4.RELEASE")
compile("org.apache.httpcomponents:httpclient:4.5.2")
compile("org.apache.tomcat:tomcat-juli:8.0.36")
compile("org.yaml:snakeyaml:1.17")
testCompile 'org.springframework.boot:spring-boot-starter-test:1.4.2.RELEASE'
}
Run Code Online (Sandbox Code Playgroud)
输出gradlew dependencies如下所示:
compile - Dependencies for source set 'main'.
+--- org.springframework.boot:spring-boot-starter:1.4.2.RELEASE
| +--- org.springframework.boot:spring-boot:1.4.2.RELEASE
| | +--- org.springframework:spring-core:4.3.4.RELEASE
| | | \--- commons-logging:commons-logging:1.2
| | \--- org.springframework:spring-context:4.3.4.RELEASE
| | +--- org.springframework:spring-aop:4.3.4.RELEASE
| | | +--- org.springframework:spring-beans:4.3.4.RELEASE
| | | | \--- org.springframework:spring-core:4.3.4.RELEASE (*)
| | | \--- org.springframework:spring-core:4.3.4.RELEASE (*)
| | +--- org.springframework:spring-beans:4.3.4.RELEASE (*)
| | +--- …Run Code Online (Sandbox Code Playgroud)