How to change GWT.xml with maven profile by a GWT project

1,026 views
Skip to first unread message

Kotuboy

unread,
Nov 2, 2011, 9:20:53 AM11/2/11
to google-we...@googlegroups.com
Currently, i am working on a gwt-maven project. As every GWT project, it has the following gwt.xml

    <module rename-to='myProject'>
    <!-- Inherit the core Web Toolkit stuff. -->
    <inherits name='com.google.gwt.user.User' />
       .
       .    
       ...

I created another gwt.xml to set configuration for continous integration. (as defined here.)

    <module rename-to='myProject'>
        <!-- Inherit the core Web Toolkit stuff. -->
        <inherits name='com.myCompany.myProject' />
       .
       .    
       ...

and here is my pom to manage the profiles and change the gwt.xml.

    <profile>
      <id>ci</id>
        <build>
          <plugins>
            <plugin>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>gwt-maven-plugin</artifactId>
              <configuration>
                      <module>com.myCompany.myProject</module>
                      <style>OBF</style>
              </configuration>
          </plugin>
        </plugins>
     </build>
           
    </profile>



If i try to package the project with profile ci (mvn package -Pci), i get the following error.

    [ERROR] Failed to execute goal org.codehaus.mojo:gwt-maven-plugin:2.3.0-1:compile (default) on project MyProject: GWT Module com.myCompany.myProject not found in project sources or resources. -> [Help 1]



Where is the problem? How can i solve it?

Hilco Wijbenga

unread,
Nov 2, 2011, 12:28:47 PM11/2/11
to google-we...@googlegroups.com

Isn't "not found" very clear? Maven cannot find your gwt.xml file. Did
you put it in src/main/resources?

Gary S

unread,
Nov 2, 2011, 3:15:24 PM11/2/11
to Google Web Toolkit
It's not clear. gwt-maven-plugin user's guide
http://mojo.codehaus.org/gwt-maven-plugin/user-guide/project.html
has a screenshot eclipse package explorer of gwt.xml in src/main/
resources then under Multi-project setup a text diagram with gwt.xml
in src/main/java

Then http://code.google.com/webtoolkit/doc/latest/DevGuideOrganizingProjects.html
shows
<module rename-to="com.foo.MyModule">
<inherits name="com.foo.MyModule" />
<set-property name="user.agent" value="ie6" />
<set-property name="locale" value="default" />
</module>

Why inherit its own name?

I could build in Eclipse but Hudson couldn't find my module. What
finally worked was adding a module property like this
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${gwt-maven-plugin.version}</version>
<configuration>
<module>xxx.xxx.xxx.xxxClient</module>
<runTarget>xxx.xxx.xxx/xxxclient.html</runTarget>
<hostedWebapp>${webappDirectory}</hostedWebapp>
</configuration>
Which I found after endless googling here
http://jgonian.wordpress.com/2011/02/24/efficient-gwt-development-swap-your-gwt-xml-with-maven/

Hilco Wijbenga

unread,
Nov 2, 2011, 6:01:17 PM11/2/11
to google-we...@googlegroups.com
On 2 November 2011 12:15, Gary S <agil...@earthlink.net> wrote:
> It's not clear. gwt-maven-plugin user's guide
> http://mojo.codehaus.org/gwt-maven-plugin/user-guide/project.html
> has a screenshot eclipse package explorer of gwt.xml in src/main/
> resources then under Multi-project setup a text diagram with gwt.xml
> in src/main/java

Yes, this is the setup you should follow. If you use Maven you
can/should ignore the weird setup that GWT recommends (mixing source
and compiled output and including JARs in SCM).

> Then http://code.google.com/webtoolkit/doc/latest/DevGuideOrganizingProjects.html
> shows
> <module rename-to="com.foo.MyModule">
>  <inherits name="com.foo.MyModule" />
>  <set-property name="user.agent" value="ie6" />
>  <set-property name="locale" value="default" />
> </module>
>
> Why inherit its own name?

Probably a typo, I suspect it should be inheriting from WorkingModule.

> I could build in Eclipse but Hudson couldn't find my module. What
> finally worked was adding a module property like this
>                        <!-- GWT Maven Plugin -->
>                         <plugin>
>                                <groupId>org.codehaus.mojo</groupId>
>                                <artifactId>gwt-maven-plugin</artifactId>
>                                <version>${gwt-maven-plugin.version}</version>
>                                <configuration>
>                                  <module>xxx.xxx.xxx.xxxClient</module>
>                                        <runTarget>xxx.xxx.xxx/xxxclient.html</runTarget>
>                                        <hostedWebapp>${webappDirectory}</hostedWebapp>
>                                </configuration>
> Which I found after endless googling here
> http://jgonian.wordpress.com/2011/02/24/efficient-gwt-development-swap-your-gwt-xml-with-maven/

This is what I use (GWT Maven Plugin 2.3.0-1 / GWT 2.4.0):

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>

<configuration>
<runTarget>/index.html</runTarget>
<hostedWebapp>${project.build.directory}/${project.artifactId}</hostedWebapp>
<webappDirectory>${project.build.directory}/${project.artifactId}</webappDirectory>
<copyWebapp>true</copyWebapp>
<port>${env.IP_GWT_HOSTED_MODE_PORT}</port>
<strict>true</strict>
</configuration>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>${gwt.main.version}</version>
</dependency>
</dependencies>
</plugin>

It's part of my parent POM and works for all of my GWT projects
*without changes*. Try it out and see how it works for you. I don't
use the <client> element but it doesn't look very portable (i.e.
reusable by other GWT projects without changes).

Reply all
Reply to author
Forward
0 new messages