【发布时间】:2019-08-15 05:21:13
【问题描述】:
我想在谷歌应用引擎上部署我的 spring 应用,但我收到了这个错误消息:
Execution failed for task ':appengineDeploy'.
> Deployment projectId must be defined or configured to read from system state
1. Set appengine.deploy.projectId = 'my-project-id'
2. Set appengine.deploy.projectId = 'GCLOUD_CONFIG' to use project from gcloud config.
3. Using appengine.deploy.projectId = 'APPENGINE_CONFIG' has been deprecated.
我的笔记本电脑上已经安装了谷歌云 sdk 和应用引擎工具。
我在互联网上搜索,我发现我必须将项目 ID 放在 gradle 文件中:
appengine {
deploy {
projectId = "my-project-id"
}
}
但问题是 gradle 无法解析所有这些属性。
我的 gradle 文件是否存在可能导致此问题的问题?
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
buildscript {
dependencies {
classpath("com.google.cloud.tools:appengine-gradle-plugin:2.1.0")
}
}
plugins {
id("org.springframework.boot") version "2.2.0.M4"
id("io.spring.dependency-management") version "1.0.7.RELEASE"
kotlin("jvm") version "1.3.31"
kotlin("plugin.spring") version "1.3.31"
}
apply(plugin = "com.google.cloud.tools.appengine")
group = "com.demo.app"
version = "1.0"
java.sourceCompatibility = JavaVersion.VERSION_1_8
repositories {
mavenCentral()
maven { url = uri("https://repo.spring.io/snapshot") }
maven { url = uri("https://repo.spring.io/milestone") }
}
extra["springCloudVersion"] = "Hoxton.M1"
dependencies {
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.springframework.cloud:spring-cloud-starter-netflix-eureka-server")
implementation("org.springframework.boot:spring-boot-starter-web")
testImplementation("org.springframework.boot:spring-boot-starter-test") {
exclude(group = "org.junit.vintage", module = "junit-vintage-engine")
exclude(group = "junit", module = "junit")
}
}
dependencyManagement {
imports {
mavenBom("org.springframework.cloud:spring-cloud-
dependencies:${property("springCloudVersion")}")
}
}
tasks.withType<Test> {
useJUnitPlatform()
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "1.8"
}
}
【问题讨论】:
标签: spring google-app-engine google-cloud-platform gradle-kotlin-dsl