GAEを初めて使用しています。私はフェッチの非同期バージョンここで、APIドキュメントによると、命名された「fetchAsync()」(パッケージ「com.google.appengine.api.urlfetchの*」の): https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/urlfetch/URLFetchServiceJava GAE + Gradle:「com.google.appengine.api.urlfetch.URLFetchService」に「fetchAsync()」というメソッドがないのはなぜですか?
しかし、私のJavaコードで、何のメソッドは、指定しないようです。 - "fetchAsync()は" それは "方法「fetchAsync(com.google.appengine.api.urlfetch.HTTPRequest)を解決できない" と言うの下に私のJavaコードです:私は確信している
URL url = new URL("https://www.bitesquad.com" + href);
HTTPRequest request = new HTTPRequest(url, HTTPMethod.GET);
HTTPResponse response = URLFetchServiceFactory.getURLFetchService().fetchAsync(request);
そのI I "fetch()"を実行しても問題ありません。私は自分のbuild.gradleに適切なバージョンのGAEを含めなかったか、それとも何かが足りないと思っています。 Googleがドキュメントを更新しなかったのでしょうか?以下は私のbuild.gradleです:
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:+'
compile "org.apache.httpcomponents:httpclient:4.5.3"
compile "org.apache.commons:commons-lang3:3.5"
compile "com.google.code.gson:gson:2.8.0"
// https://mvnrepository.com/artifact/com.google.appengine/appengine-api-1.0-sdk
compile group: 'com.google.appengine', name: 'appengine-api-1.0-sdk', version: '1.2.0'
testCompile 'junit:junit:4.12'
testCompile group: 'junit', name: 'junit', version: '4.12'
}
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
}
//tools.cloudSdkHome = '/Applications/google-cloud-sdk'
}
group 'xxx'
version 'xxx'
sourceCompatibility = 1.7 // App Engine Standard uses Java 7
targetCompatibility = 1.7 // App Engine Standard uses Java 7
ありがとうございます!
レビューのGradleスクリプトをスレッドを以下に> https://stackoverflow.com/質問/ 29673764/the-package-com-google-appengine-api-urlfetch-can not-found –