Maven 2 修改GWT';发布时,请单击s user.agent
在开发时,我将Maven 2 修改GWT';发布时,请单击s user.agent,maven-2,gwt,Maven 2,Gwt,在开发时,我将user.agent属性设置为单个值,以减少编译时间。发布时,我为所有用户代理构建了一个WAR文件 不幸的是,我似乎总是忘记切换属性,或者: 浪费开发时间等待编译,或者 正在准备一个不完全支持浏览器的WAR文件(谢天谢地,尚未部署) 我想自动化这个,最好使用maven发布插件 您希望有两个不同的.gwt.xml文件—一个用于开发,另一个用于生产 在的“重命名模块”部分有一个很好的示例 用于开发的gwt.xml文件将继承用于生产的gwt.xml文件,并设置user.agent属性
user.agent
属性设置为单个值,以减少编译时间。发布时,我为所有用户代理构建了一个WAR文件
不幸的是,我似乎总是忘记切换属性,或者:
- 浪费开发时间等待编译,或者
- 正在准备一个不完全支持浏览器的WAR文件(谢天谢地,尚未部署)
我想自动化这个,最好使用maven发布插件 您希望有两个不同的.gwt.xml文件—一个用于开发,另一个用于生产 在的“重命名模块”部分有一个很好的示例 用于开发的gwt.xml文件将继承用于生产的gwt.xml文件,并设置user.agent属性。e、 g:
<module rename-to="com.foo.MyModule">
<inherits name="com.foo.MyModule" />
<set-property name="user.agent" value="ie6" />
</module>
现在,在进行开发时,您将使用development gwt.xml文件,以及在进行生产构建时。您将使用生产gwt.xml文件
使用Maven实现这一点的最简单方法是使用概要文件激活开发模块。我已经在上详细介绍了这一点。创建一个MavenFilteredUserAgent模块,该模块从pom.xml中的各种配置文件中设置
user.agent
MavenFilteredUserAgent.gwt.xml
...
<set-property name="user.agent" value="${gwt.compile.user.agent}" />
...
...
<properties>
<!-- By default we still want all five rendering engines when none of the following profiles is explicitly specified -->
<gwt.compile.user.agent>ie6,ie8,gecko,gecko1_8,safari,opera</gwt.compile.user.agent>
</properties>
<profiles>
<profile>
<id>gwt-firefox</id>
<properties>
<gwt.compile.user.agent>gecko1_8</gwt.compile.user.agent>
</properties>
</profile>
</profiles>
<!-- Add additional profiles for the browsers you want to singly support -->
....
<build>
<resources>
<resource>
<!-- Put the filtered source files into a directory that later gets added to the build path -->
<directory>src/main/java-filtered</directory>
<filtering>true</filtering>
<targetPath>${project.build.directory}/filtered-sources/java</targetPath>
</resource>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
</resource>
</resources>
<plugins>
...
<plugin>
<!-- Add the filtered sources directory to the build path-->
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/filtered-sources/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
...
</plugins>
...
。。。
...
pom.xml
...
<set-property name="user.agent" value="${gwt.compile.user.agent}" />
...
...
<properties>
<!-- By default we still want all five rendering engines when none of the following profiles is explicitly specified -->
<gwt.compile.user.agent>ie6,ie8,gecko,gecko1_8,safari,opera</gwt.compile.user.agent>
</properties>
<profiles>
<profile>
<id>gwt-firefox</id>
<properties>
<gwt.compile.user.agent>gecko1_8</gwt.compile.user.agent>
</properties>
</profile>
</profiles>
<!-- Add additional profiles for the browsers you want to singly support -->
....
<build>
<resources>
<resource>
<!-- Put the filtered source files into a directory that later gets added to the build path -->
<directory>src/main/java-filtered</directory>
<filtering>true</filtering>
<targetPath>${project.build.directory}/filtered-sources/java</targetPath>
</resource>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
</resource>
</resources>
<plugins>
...
<plugin>
<!-- Add the filtered sources directory to the build path-->
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/filtered-sources/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
...
</plugins>
...
。。。
ie6,ie8,壁虎,壁虎,狩猎,歌剧
gwt firefox
壁虎
....
src/main/java过滤
真的
${project.build.directory}/filteredsources/java
${project.basedir}/src/main/resources
...
org.codehaus.mojo
有更多详细信息。您的网站是否可以公开访问?在哪里?我也想为Ant看一下。@Don Branson:不,这个网站不是公开的。谢谢你的回答。我尝试了它(使用GWT1.5)并按照预期进行了编译。唯一的障碍是my Application.html仍然引用Application.nocache.js,而不是applicationRefex.nocache.js。参考:firefox构建中使用的gwt.xml是否以开头?您是正确的,缺少将重命名为。我会用我使用过的maven设置更新答案。因为你会想从默认列表中删除gecko。这基本上应该与我始终获得的基本列表相同:[INFO][ERROR]无效属性值“${gwt.compile.user.agent}”[INFO][ERROR]在解析XML时失败