buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.bmuschko:gradle-tomcat-plugin:2.5'
}
}
plugins {
id 'idea'
id 'java'
id 'war'
id "com.bmuschko.tomcat" version "2.5"
}
group 'ge.tutor'
version '1.0-SNAPSHOT'
apply plugin: 'java'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
jcenter()
}
tomcatRun.contextPath = ''
dependencies {
testCompile 'junit:junit:4.12'
}
tomcat {
httpProtocol = 'org.apache.coyote.http11.Http11Nio2Protocol'
ajpProtocol = 'org.apache.coyote.ajp.AjpNio2Protocol'
}
dependencies {
//Libraries for web server deployment
providedCompile group: 'javax', name: 'javaee-api', version: '8.0'
def tomcatVersion = '9.0.8'
tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}",
"org.apache.tomcat.embed:tomcat-embed-logging-juli:9.0.0.M6",
"org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}"
providedCompile 'javax.servlet:javax.servlet-api:3.1.0'
//add here custom dependencies
}
这是我在项目中的build.gradle文件。我用tomcatRun命令运行它。我想在Heroku上部署它,但是看来我在错误地构建它。 Heroku日志说它正确构建并且可以在locallhost:8080 /上运行,但是由于我怀疑heroku使用的端口不同。 (也许是80岁,但我不能更改我的,因为它是tomcat)如何在Heroku上正确部署此项目?在gradle上找不到tomcat项目的指南。