Setting properties like user.agent and mobile.user.agent specifically..how to set them for gwt:run/package?

224 views
Skip to first unread message

Michael Kohout

unread,
Oct 6, 2011, 3:29:42 PM10/6/11
to Codehaus Mojo gwt-maven-plugin Users
Hi-

I'm a new GWT user who is trying to port a large existing app(using
gwt v2.4.0) from ant to maven. However, I'm bumping into a issue.

This application makes judicious use of properties user.agent and
mobile.user.agent to replace components targeted at specific
browsers. I've tried a number of different strategies to set these
properties, from setting them as command-line parameters via the
plugin's extraJvmArgs config option(which doesn't seem supported by
gwt 2.4) to adding these parameters to the top level application
gwt.xml file. However, no matter what I've done when the gwt dev mode
console pops up after a mvn gwt:run, I get the error "Property
'mobile.user.agent' not found".

Am I setting this property in the correct place? Am I missing
something obvious from the existing documentation?

thanks,
Mike Kohout

Below is my configuration for the plugin from my pom:

....gwtVersion = 2.4.0 below
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.3.0-1</version>

<!-- JS is only needed in the package phase, this
speeds up testing -->
<executions>
<execution>
<configuration>
<extraJvmArgs>-
Dmobile.user.agent=mobilesafari -Duser.agent=safari,gecko1_8 -
Xmx1024M</extraJvmArgs>
<module>jb.gwt_main.GwtMain</module>
</configuration>
<phase>prepare-package</phase>
<goals>
<goal>compile</goal>
<goal>test</goal>
<!--<goal>i18n</goal> -->
</goals>
</execution>
</executions>

<!-- Plugin configuration. There are many available
options,
see gwt-maven-plugin documentation at
codehaus.org -->
<configuration>
<!-- URL that should be automatically opened in
the GWT shell (gwt:run). -->
<runTarget>jb.gwt_main.GwtMain/GwtMain.html</
runTarget>
<!-- Ask GWT to create the Story of Your Compile
(SOYC) (gwt:compile) -->
<compileReport>true</compileReport>

<logLevel>INFO</logLevel>

<noServer>true</noServer>
<systemProperties>
<gwt.mobile.user.agent>safari</
gwt.mobile.user.agent>
<user.agent>safari</user.agent>
</systemProperties>
<extraJvmArgs>-Dgwt.mobile.user.agent=mobilesafari
-Dgwt.user.agent=safari,gecko1_8</extraJvmArgs>
</configuration>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwtVersion}</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>${gwtVersion}</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwtVersion}</version>
</dependency>
</dependencies>
</plugin>
Reply all
Reply to author
Forward
0 new messages