このガイドに従って、Maven プロジェクトに Google Cloud Endpoints を実装しました。
ここに私のpom.xmlのプロパティがあります
<properties>
<appengine.app.id>xxxxxxxx</appengine.app.id>
</properties>
これが pom.xml の私の maven-war-plugin 構成です
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<!-- http://maven.apache.org/plugins/maven-war-plugin/examples/adding-filtering-webresources.html -->
<!-- To prevent corrupting your binary files when filtering is enabled, you can configure a list of file extensions that will not be filtered. -->
<nonFilteredFileExtensions>
<nonFilteredFileExtension>p12</nonFilteredFileExtension>
</nonFilteredFileExtensions>
<archiveClasses>true</archiveClasses>
<!-- https://cloud.google.com/appengine/docs/java/tools/maven#cloud_endpoints_goals -->
<webXml>${project.build.directory}/generated-sources/appengine-endpoints/WEB-INF/web.xml</webXml>
<webResources>
<!-- in order to interpolate version from pom into appengine-web.xml -->
<resource>
<directory>${basedir}/src/main/webapp/WEB-INF</directory>
<filtering>true</filtering>
<targetPath>WEB-INF</targetPath>
</resource>
<resource>
<directory>${project.build.directory}/generated-sources/appengine-endpoints</directory>
<includes>
<include>WEB-INF/*.discovery</include>
<include>WEB-INF/*.api</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
これが私の appengine-web.xml ファイルの先頭です
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>${appengine.app.id}</application>
<version>${project.version}</version>
....
</appengine-web-app>
生成データはこちら
.discoveryファイルが作成中に maven プロパティを解決 しない問題
mystore-v1-rest.discovery
"protocol": "rest",
"baseUrl": "https://${appengine.app.id}.appspot.com/_ah/api/mystore/v1/",
"basePath": "/_ah/api/mystore/v1/",
"rootUrl": "https://${appengine.app.id}.appspot.com/_ah/api/",
"servicePath": "mystore/v1/",
mystore-v1-rpc.discovery
protocol": "rpc",
"rootUrl": "https://${appengine.app.id}.appspot.com/_ah/api/",
"rpcUrl": "https://${appengine.app.id}.appspot.com/_ah/api/rpc",
"rpcPath": "/_ah/api/rpc",
このファイルが、WEB-INF フォルダーに保存されている他のファイルのようにフィルター処理されないのはなぜですか?
多くのファイル (WEB-INF 親フォルダーの下) で Maven 変数を使用していますが、値は問題なく置き換えられます。
.discoveryファイルでもフィルタリングできるように構成を調整するにはどうすればよいですか?
application
(lib 生成中に) appengine-web.xml からの値が値を解決せずに取得され、Maven ビルド中にフィルタリングが適用されないと思います。
<filtering>true</filtering>
リソース構成に追加しようとしましたが、成功しませんでした
--- 編集 25/01/2014 ---
いくつかの提案を受けた後、元の投稿で書き忘れたことを明確にする必要があります。
問題はに関連していますendpoints_get_discovery_doc
ここにMavenの目標のログがあります
API Discovery Document written to ..\target\generated-sources\appengine-endpoints\WEB-INF/mystore-v3-rpc.discovery
API Discovery Document written to ..\target\generated-sources\appengine-endpoints\WEB-INF/mystore-androidtest-rpc.discovery
ファイル\target\generated-sources\appengine-endpoints\WEB-INF/mystore-v3-rpc.discovery
は endpoints ゴールによって生成され、フィルタリングされません。
フィルタリング機能があっても
<resource>
<directory>${project.build.directory}/generated-sources/appengine-endpoints</directory>
<filtering>true</filtering>
<includes>
<include>WEB-INF/*.discovery</include>
<include>WEB-INF/*.api</include>
</includes>
</resource>
生成されたファイルはフィルタリングされません。
ファイルをフォルダに直接書き込むと${project.build.directory}/generated-sources/appengine-endpoints
、ファイルがフィルタリングされないことが問題でしょうか?