【发布时间】:2018-02-04 06:35:13
【问题描述】:
我想重写这个https://github.com/GoogleCloudPlatform/getting-started-java/tree/master/appengine-standard-java8/springboot-appengine-standard 使用 gradle 而不是 maven 的简单 Spring Boot 应用程序。
我主要成功了 gradle bootRun 和 appengineDeploy 工作正常,但 appengineRun 失败:
java.lang.IllegalArgumentException: Unable to find the main class to restart
at org.springframework.util.Assert.notNull(Assert.java:134)
at org.springframework.boot.devtools.restart.Restarter.doStart(Restarter.java:285)
at org.springframework.boot.devtools.restart.Restarter.start(Restarter.java:273)
at org.springframework.boot.devtools.restart.Restarter$1.call(Restarter.java:174)
at org.springframework.boot.devtools.restart.Restarter$1.call(Restarter.java:170)
at org.springframework.boot.devtools.restart.Restarter$LeakSafeThread.run(Restarter.java:627)
error.
我的 gradle.build:
buildscript {
repositories {
jcenter() // Bintray's repository - a fast Maven Central mirror & more
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:+")
classpath 'com.google.cloud.tools:appengine-gradle-plugin:+'
}
}
repositories {
maven {
url 'https://maven-central.storage.googleapis.com' // Google's mirror of Maven Central
}
jcenter()
mavenCentral()
}
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'com.google.cloud.tools.appengine'
apply plugin: 'org.springframework.boot'
enter code here
bootRepackage {
enabled = false
}
configurations {
compile.exclude module: "spring-boot-starter-tomcat"
compile.exclude module: "spring-boot-starter-jetty"
}
dependencies {
providedCompile 'javax.servlet:javax.servlet-api:3.1.0'
compile 'com.google.appengine:appengine:+'
// Use JUnit test framework
testImplementation 'junit:junit:4.12'
compile("org.springframework.boot:spring-boot-devtools")
compile("org.springframework.boot:spring-boot-starter-web")
}
appengine { // App Engine tasks configuration
run { // local (dev_appserver) configuration (standard environments only)
port = 8080 // default
}
deploy { // deploy configuration
stopPreviousVersion = true // default - stop the current version
promote = true // default - & make this the current version
}
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
工作 pom.xml 位于我上面链接的 git repo 中(stackoverflow 不允许我使用 2 个链接 :-))
我认为解决方案很简单,我只是没有经验,也没有 gradle 或 appengine。任何帮助将不胜感激。
【问题讨论】:
标签: java maven google-app-engine spring-boot gradle