After a day or so playing around I have made a Maven pom.xml that
respects the directory structure output by the webappCreator tool.

Here are the relevant bits.  Again, for veteran Maven users, rather
than try to make the GWT Eclipse Plugin respect a tried-and-true maven
layout, which I've read on this group is kind of tough if not
impossible, I went the other way around.  That means that you will NOT
see a src/main/java directory, and the war source directory will also
be used as the target (that's how the GWT tools do it).

Another way to put it is that I followed the advice of the plugin
authors who said when in doubt try to make your custom build tooling
do what the base ant build.xml does.

Lastly, this POM fragment uses the Codehaus gwt-maven-plugin, so if
you run:

mvn package

...you'll get your war file in the good old target directory (where it
should be, of course) and your in-place war in the war directory.
This should allow Eclipse folks to work normally, as well as hosted
mode.

I hope this helps someone; it took WAY too long to do this.

As of today, April 22, the only known issue is that the gwt-maven-
plugin will "see" your module twice (you can configure it to only look
for specific modules and can avoid this; I didn't).  That means at the
moment that at package time you'll run the resource-hoggy GWT compiler
twice.  :-(  I think that bug will probably be fixed very soon, so I
didn't choose to work around it in this pom fragment.

  <dependencies>

    <!-- GWT dependencies (from maven "central" repo) -->
    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-servlet</artifactId>
      <version>${gwt.version}</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-user</artifactId>
      <version>${gwt.version}</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>

  <build>
    <sourceDirectory>src</sourceDirectory>
    <testSourceDirectory>test</testSourceDirectory>
    <outputDirectory>war/WEB-INF/classes</outputDirectory>
    <resources>
      <resource>
        <directory>${project.build.sourceDirectory}</directory>
        <targetPath></targetPath>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </resource>
    </resources>

    <plugins>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <configuration>
          <encoding>utf-8</encoding>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>LATEST</version>
        <configuration>
          <warSourceDirectory>${basedir}/war</warSourceDirectory>
          <!--
              We don't need to include any sources to copy to the
target,
              because the target *is* our source.
          -->
          <warSourceIncludes></warSourceIncludes>
          <warSourceExcludes>**</warSourceExcludes>
          <webappDirectory>${basedir}/war</webappDirectory>
          <webXml>${basedir}/war/WEB-INF/web.xml</webXml>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>gwt-maven-plugin</artifactId>
        <version>1.1-SNAPSHOT</version>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
              <!--
              <goal>generateAsync</goal>
              -->
            </goals>
          </execution>
        </executions>
        <configuration>
          <runTarget>path.to.your.Module/../Module.html</runTarget>
          <output>${basedir}/war</output>
          <webXml>${basedir}/war/WEB-INF/web.xml</webXml>
          <hostedWebapp>${basedir}/war</hostedWebapp>
        </configuration>
      </plugin>

    </plugins>
  </build>

  <pluginRepositories>
    <pluginRepository>
      <id>Codehaus</id>
      <url>http://snapshots.repository.codehaus.org</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </pluginRepository>
  </pluginRepositories>

  <properties>
    <gwt.version>1.6.4</gwt.version>
  </properties>

I hope this helps.

Best,
Laird

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to