使用Gradle部署GAE时奇怪的构建失败

时间:2018-06-28 16:08:26

标签: google-app-engine gradle deployment build

直到今天,一切正常。据我所知没有改变任何东西,现在我明白了:

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

我刚刚将gradle从4.5.1版本更新到了4.8.1,但是仍然存在相同的问题。我知道它抱怨appengine的版本,但是我从来没有说过,所以我认为这是由于Google方面的一些更新。我想念什么?

2 个答案:

答案 0 :(得分:7)

您现在正在使用app-gradle-plugin版本2.0.0-rc1,正如我从两天前发布的控制台输出中看到的那样。它有一些更改,插件的开发人员已记录在案。

正如您在Google的此候选版本的Change Log中所看到的,它在更改中提到了:

  默认情况下,

项目和版本不再从全局gcloud状态中提取。必须使用deploy.project属性在build.gradle中配置项目,用户可以为项目使用特殊关键字来指定他们要从appengine-web.xml(project =“ APPENGINE_CONFIG”)或从gcloud全局状态( project =“ GCLOUD_CONFIG”)。版本也以相同的方式配置。

因此,您只需要在gradle.build中指定以下内容:

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

在2.0.0-rc3中更新 (感谢@ wildcat12指出) 在最新版本2.0.0-rc3中,project配置属性已更改。

  

更改了appengine.deploy.project-> appengine.deploy.projectId

因此,现在您的gradle.build配置如下所示:

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

答案 1 :(得分:0)

如果您使用

classpath 'com.google.cloud.tools:appengine-gradle-plugin:+'
您的build.gradle文件中的

行现在正在使用2.0.0-rc3发行候选版本。在最近的稳定版本1.3.5上运行良好。