我知道在我的 *.gwt.xml 文件中,我可以通过添加以下内容来指定我希望 GWT 编译器编译我的应用程序的浏览器:
<set-property name="user.agent" value="opera,ie8, gecko1_8, safari, ie9"/>
当我通过maven构建项目时,是否可以在命令行上设置此属性?当我在我的机器上进行本地开发时,我希望能够执行以下操作:
mvn clean install -Duser.agent="opera,ie8"
EDIT:从 GWT 2.7 开始,您现在可以通过-setProperty user.agent=…
在命令行上;无需再调整 gwt.xml 文件。我不确定 GWT 的 Mojo 插件是否允许您使用它,但是net.ltgt.gwt.maven
GWT 的 Maven 插件即可。
您可以使用过滤您的资源 http://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html,但这可能会使在 IDE 中工作变得更加困难。
在您的 gwt.xml 中:
<set-property name="user.agent" value="${user.agent}" />
然后在你的 pom.xml 中:
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
以及当您不在命令行上给出属性时的默认值:
<properties>
<user.agent>opera,ie8,gecko1_8,safari,ie9</user.agent>
</properties>
但请注意,这违背了内行之道™ http://developer-blog.cloudbees.com/2013/04/the-maven-way.html.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)