小编use*_*453的帖子

在Tomcat服务器上使用Gradle构建部署Spring应用程序

我是春天和Gradle的新手.我正在尝试使用Tomcat服务器上的Gradle构建部署Spring应用程序.我能够生成一个war文件,但是我没有用于映射servlet的web.xml文件,也没有映射servlet.我有一个主类和配置类.

那么,为了在tomcat上部署我的应用程序我需要做什么?我找不到适合自己的最终文章.我浏览了这个http://docs.spring.io/spring-boot/docs/current/reference/html/howto-traditional-deployment.html(本文主要涉及maven存储库/插件而不是Gradle部分)能够只生成war文件.由于我没有任何web.xml,我不知道如何部署它.任何人都可以帮我这个.

   buildscript {
  repositories {
    maven { url "" }
    mavenLocal()
   }
   dependencies {
    classpath("org.springframework.boot:spring-boot-gradle-     plugin:1.0.2.RELEASE")

}
    }

 apply plugin: 'java'
 apply plugin: 'eclipse'
 apply plugin: 'idea'
 apply plugin: 'spring-boot'


 apply plugin: 'war'

war {
baseName = 'abc-service'
version =  '0.1.0'
}


 repositories {
mavenCentral()
maven { url "" }
}

dependencies {
compile("org.springframework:spring-jdbc")
compile("org.springframework:spring-oxm")
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-data-jpa")
compile("com.fasterxml.jackson.core:jackson-databind")
compile("com.h2database:h2")
compile("mysql:mysql-connector-java:5.1.16")
compile("com.paypal.sdk:rest-api-sdk:1.4.1")

compile("commons-dbcp:commons-dbcp:1.4")
compile("com.sun.mail:javax.mail:1.5.5")
providedRuntime("org.springframework.boot:spring-boot-starter-tomcat");
testCompile("junit:junit")
}

task wrapper(type: Wrapper) {
gradleVersion = '2.1'
 }
Run Code Online (Sandbox Code Playgroud)

以下是我的用户控制器的示例代码:

 @Controller
public …
Run Code Online (Sandbox Code Playgroud)

java spring tomcat hibernate gradle

3
推荐指数
1
解决办法
5100
查看次数

标签 统计

gradle ×1

hibernate ×1

java ×1

spring ×1

tomcat ×1