用什么maven插件可以得到appengine-web.xml
基于maven配置文件运行生成的应用程序,例如-Pdev
或 -Pprod
示例:
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>myapp-dev</application>
<version>1</version>
<static-files/>
<threadsafe>true</threadsafe>
<precompilation-enabled>false</precompilation-enabled>
</appengine-web-app>
对于 -Pdev
, 当配置文件是 -Pprod
应用程序名称将是:<application>myapp-prod</application>
最佳答案
您可以使用 maven-war-plugin 更改应用程序的版本和名称
在 appengine-web.xml 中,写下几行
<application>${appengine.app}</application>
<version>${version.number.gae}</version>
这是你需要的maven插件
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<warSourceDirectory>${project.basedir}/src/main/webapp</warSourceDirectory>
<webappDirectory>${project.build.directory}/${project.artifactId}</webappDirectory>
<filters>
<filter>src/main/resources/application.properties</filter>
<filter>src/main/webapp/WEB-INF/appengine-web.xml</filter>
</filters>
<webResources>
<resource>
<directory>src/main/webapp</directory>
<filtering>true</filtering>
<includes>
<include>**/appengine-web.xml</include>
<include>**/web.xml</include>
<include>open_graph/**</include>
</includes>
</resource>
</webResources>
<!-- Exclude all timestamp specific static files. (see maven-resource-plugin in this pom.xml) -->
<warSourceExcludes>css/**,flash/**,mobile/**,images/**,<!--js/**,-->sounds/**,channel.html</warSourceExcludes>
</configuration>
</plugin>
和 maven 配置文件
<profiles>
<profile>
<id>dev</id>
<properties>
<appengine.app>my-gae-dev</appengine.app>
<version.number.gae>1</version.number.gae>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>
<appengine.app>my-gae-prod</appengine.app>
<version.number.gae>1</version.number.gae>
</properties>
</profile>
</profiles>
关于java - 基于 Maven 配置文件的 web.xml 配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29295297/