当前位置:  开发笔记 > 编程语言 > 正文

使用gradle部署GAE时出现奇怪的构建失败

如何解决《使用gradle部署GAE时出现奇怪的构建失败》经验,为你挑选了1个好方法。

到目前为止,一切都很好.据我所知,没有改变任何东西,现在我得到了这个:

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

我刚刚从版本4.5.1更新了gradle到4.8.1,但同样的问题仍然存在.我理解它抱怨了appengine的版本,但我从来没有说过,所以我认为这是由于谷歌方面的一些更新.我错过了什么?



1> Hesham Masso..:

您现在正在使用app-gradle-plugin版本2.0.0-rc1,因为我可以从您的控制台输出中看到,该输出在2天前发布.它有一些变化,插件的开发人员记录了这些变化.

正如您可以在Google的此版本候选版本的更改日志中看到的那样,它会在更改中提及:

默认情况下,项目和版本不再从全局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中更新2.0.0-rc3(感谢@ wildcat12指出),配置属性已更改.project

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

因此,现在您的gradle.build配置看起来像这样:

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

推荐阅读
oDavid_仔o_880
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有