1

I want to deploy my spring app on google app engine but i got this error message :

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.

google cloud sdk and app engine tools are already installed on my laptop.

i searched on the internet and i found that i must put the project ID in gradle file :

appengine {
  deploy {
    projectId = "my-project-id"
  }
}

but the problem is that gradle can not resoble all of these properties.

is there a problem with my gradle file that may caused this problem?

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"
    }
}

1 Answers1

1

Try setting your project in your SDK, and then using the below code

appengine {
    deploy {
        projectId = "GCLOUD_CONFIG"
    }
}
Andres S
  • 1,168
  • 7
  • 11
  • thank you for your answer, but i have already configured the project. i think the problem is in adding the app engine plugin in gradle. i am still not familiar with the kotlin gradle dsl, so i think I have not correctly added and applied the plugin .. i tried to deploy a project with maven and everything went well –  Aug 14 '19 at 22:14
  • 1
    i finally found the solution in this [post](https://stackoverflow.com/a/48510049/10256891) –  Aug 15 '19 at 08:35