gpt4 book ai didi

java - 无法运行 Gradle 应用引擎任务

转载 作者:行者123 更新时间:2023-11-30 06:06:31 25 4
gpt4 key购买 nike

我对将旧的 Google App Engine 项目转换为 Gradle 感到非常困惑。

我正在尝试按照 this 上的说明进行操作页。它建议从这个构建脚本开始:

buildscript {    // Configuration for building
repositories {
jcenter() // Bintray's repository - a fast Maven Central mirror & more
mavenCentral()
}
dependencies {
classpath 'com.google.cloud.tools:appengine-gradle-plugin:+' // latest App Engine Gradle tasks
}
}

repositories { // repositories for Jar's you access in your code
maven {
url 'https://maven-central.storage.googleapis.com' // Google's mirror of Maven Central
// url 'https://oss.sonatype.org/content/repositories/snapshots' // SNAPSHOT Repository (if needed)
}
jcenter()
mavenCentral()
}

apply plugin: 'java' // standard Java tasks
apply plugin: 'war' // standard Web Archive plugin
apply plugin: 'com.google.cloud.tools.appengine' // App Engine tasks

dependencies {
providedCompile group: 'javax.servlet', name: 'servlet-api', version:'2.5'
compile 'com.google.appengine:appengine:+'
// Add your dependencies here.

}

appengine { // App Engine tasks configuration
run { // local (dev_appserver) configuration (standard environments only)
port = 8080 // default
}

deploy { // deploy configuration
stopPreviousVersion = true // default - stop the current version
promote = true // default - & make this the current version
}
}

group = 'com.example.appengine' // Generated output GroupId
version = '1.0-SNAPSHOT' // Version in generated output

sourceCompatibility = 1.7 // App Engine Standard uses Java 7
targetCompatibility = 1.7 // App Engine Standard uses Java 7

但是它不起作用:

$ gradle appengineRun

FAILURE: Build failed with an exception.

* Where:
Build file '/path/to/myproject/build.gradle' line: 32

* What went wrong:
A problem occurred evaluating root project 'myproject'.
> Could not find method run() for arguments [build_c1i62diotjttavcmtjg1zqlbd$_run_closure3$_closure5@33f17289] on root project 'myproject' of type org.gradle.api.Project.

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

BUILD FAILED

是否应该下载依赖项以使自定义 appengine 任务配置工作?

最佳答案

请看sources的插件。应用核心插件时,它会决定是应用灵活 还是标准 appengine 插件。由于可能没有应用 src/main/webapp/WEB-INF/appengine-web.xml 灵活的插件,它不会创建失败的扩展(仅供引用,此扩展已创建 here )。要解决此问题,请运行:

mkdir -p src/main/webapp/WEB-INF

然后:

touch src/main/webapp/WEB-INF/appengine-web.xml

build.gradle 所在的控制台中。这将解决问题。糟糕的文档:/

关于java - 无法运行 Gradle 应用引擎任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43845253/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com