Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strange build failure when deploying GAE using gradle

Everything used to work fine until today. Didn't change anything as far as I know and now I get this:

C:\mypath>gradle appengineDeploy

> Configure project :
WARNING: You are a using release candidate 2.0.0-rc1. Behavior of this plugin has changed since 1.3.5. Please see release notes at: https://github.com/GoogleCloudPlatform/app-gradle-plugin.
Missing a feature? Can't get it to work?, please file a bug at: https://github.com/GoogleCloudPlatform/app-gradle-plugin/issues.

> Task :appengineDeploy FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':appengineDeploy'.
> Deployment version must be defined or configured to read from system state
  1. Set appengine.deploy.version = 'my-version'
  2. Set appengine.deploy.version = 'GCLOUD_CONFIG' to have gcloud generate a version for you.
  3. Using APPENGINE_CONFIG is not allowed for flexible environment projects

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
See https://docs.gradle.org/4.8.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 6s
8 actionable tasks: 6 executed, 2 up-to-date

I just updated gradle from version 4.5.1 to 4.8.1 but the same issue remains. I understand it complains about version of the appengine but I never had to state that before so I think it's due to some update on Google's side. What am I missing?

like image 339
djokerndthief Avatar asked Jun 28 '18 16:06

djokerndthief


1 Answers

You are now using the app-gradle-plugin version 2.0.0-rc1 as I can see from your console output, which was released 2 days ago. It has some changes, which the developers of the plugin documented.

As you can see in the Change Log of this release candidate from google, it mentions in the changes:

project and version are no longer pulled from the global gcloud state by default. project must be configured in build.gradle using the deploy.project property, users may use special keywords for project to specify that they would like to read it from appengine-web.xml (project = "APPENGINE_CONFIG") or from gcloud global state (project = "GCLOUD_CONFIG"). version is also configured the same way.

So you just have to specify in your gradle.build the following:

appengine {
    deploy {
        version = "GCLOUD_CONFIG"
        project = "GCLOUD_CONFIG"
    }
}

Update in 2.0.0-rc3 (Thanks to @wildcat12 for pointing it out) in the latest version 2.0.0-rc3, the project configuration property has changed.

Changed appengine.deploy.project -> appengine.deploy.projectId

Therefore, now your gradle.build configuration would look like that:

appengine {
    deploy {
        version = "GCLOUD_CONFIG"
        projectId = "GCLOUD_CONFIG"
    }
}
like image 172
Hesham Massoud Avatar answered Oct 26 '22 11:10

Hesham Massoud