Well, if anyone cares, I figured out the problem..
The problem was that by specifying <warSourceDirectory>war</...>, I
forced maven to copy all the files from the 'war' directory into the
target directory. That's great and what I want, but it also copied
files in the uncompiled 'szblankweb' module. Since this step happens
after the gwt-compile, some of the compiled JS files were overwritten
by the un-compiled stubs from the 'war' directory.
So, I am not sure if this is the most elegant solution, I did the
following instead of including the entire 'war' directory:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-beta-1</version>
<configuration>
<webResources>
<resource>
<directory>war</directory>
<excludes>
<exclude>**/szblankweb/*</exclude>
</excludes>
</resource>
</webResources>
</configuration>
</plugin>
This way, I am including everything from the 'war' directory except
the stuff that's inside of the stubbed out (un-gwt-compiled) gwt
module folder, in my case 'szblankweb'.
Now, everything seems to be working correctly. If anyone sees a
potential problem with this solution or has a more elegant solution,
please let me know.
Thanks,
Yaakov.
On Tue, Jul 21, 2009 at 1:50 PM, Yaakov Chaikin<[email protected]> wrote:
> Hi,
>
> I am trying to get a very simple GWT project to gwt-compile using the
> codehaus' maven-gwt plugin but I don't seem to be having much
> success...
>
> The project is nothing more than a regular starter GWT 1.7 (same as
> 1.6 plus bug fixes) Eclipse GWT plugin project. All I did after
> creating a new project in Eclipse with the GWT Eclipse plugin was to
> create main/java under the src directory and put that into the class
> path instead of just the default src directory.
>
> My pom.xml is shown below. When I do 'mvn clean compile', I see that
> GWT compile gets kicked off, but when I go the exploded built WAR and
> double click on the host HTML page, it tells me "GWT module
> 'szblankweb' needs to be (re)compiled, please run a compile or use the
> Compile/Browse button in hosted mode". Same thing happens if I deploy
> the .war file into a container.
>
> If I run the app inside Eclipse in hosted mode and then do 'mvn
> package' (without the clean), everything works.
>
> Any idea of what I am not doing or doing wrong here?
>
> Here is my pom.xml:
> ************************************************************
> <?xml version="1.0" encoding="UTF-8"?>
> <project xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd">
> <modelVersion>4.0.0</modelVersion>
> <groupId>test</groupId>
> <artifactId>test</artifactId>
> <packaging>war</packaging>
> <version>1.0-SNAPSHOT</version>
> <name>test</name>
>
> <properties>
> <gwt.version>1.7.0</gwt.version>
> <maven.compiler.source>1.6</maven.compiler.source>
> <maven.compiler.target>1.6</maven.compiler.target>
> </properties>
>
> <dependencies>
> <dependency>
> <groupId>com.google.gwt</groupId>
> <artifactId>gwt-servlet</artifactId>
> <version>${gwt.version}</version>
> <scope>compile</scope>
> </dependency>
> <dependency>
> <groupId>com.google.gwt</groupId>
> <artifactId>gwt-user</artifactId>
> <version>${gwt.version}</version>
> <scope>provided</scope>
> </dependency>
> <dependency>
> <groupId>junit</groupId>
> <artifactId>junit</artifactId>
> <version>4.4</version>
> <scope>test</scope>
> </dependency>
> </dependencies>
>
> <build>
> <outputDirectory>war/WEB-INF/classes</outputDirectory>
> <testOutputDirectory>war/WEB-INF/classes</testOutputDirectory>
> <plugins>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-war-plugin</artifactId>
> <version>2.1-beta-1</version>
> <configuration>
>
> <warSourceDirectory>/war</warSourceDirectory>
> </configuration>
> </plugin>
> <plugin>
> <groupId>org.codehaus.mojo</groupId>
> <artifactId>gwt-maven-plugin</artifactId>
> <version>1.1</version>
> <executions>
> <execution>
> <goals>
> <goal>compile</goal>
> <goal>test</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-war-plugin</artifactId>
> <configuration>
>
> <warSourceDirectory>war</warSourceDirectory>
> </configuration>
> </plugin>
>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-compiler-plugin</artifactId>
> <version>2.0.2</version>
> <configuration>
>
> <source>${maven.compiler.source}</source>
>
> <target>${maven.compiler.target}</target>
> </configuration>
> </plugin>
> </plugins>
> </build>
> </project>
> ************************************************************
>
>
> Here is the output of maven when I run against the pom.xml above:
> ************************************************************
> [INFO] Scanning for projects...
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Building test
> [INFO]
> [INFO] Id: test:test:war:1.0-SNAPSHOT
> [INFO] task-segment: [clean, package]
> [INFO]
> ------------------------------------------------------------------------
> [INFO] [clean:clean]
> [INFO] Deleting directory D:\workspaces\Pull\szBlankWeb\target
> [INFO] Deleting directory D:\workspaces\Pull\szBlankWeb\war\WEB-INF\classes
> [INFO] [resources:resources]
> [INFO] Using default encoding to copy filtered resources.
> [INFO] [compiler:compile]
> [INFO] Compiling 4 source files to
> D:\workspaces\Pull\szBlankWeb\war\WEB-INF\classes
> [INFO] [gwt:compile]
> [INFO] using GWT jars from project dependencies : 1.7.0
> [INFO] Unpack native libraries required to run GWT
> [INFO] auto discovered modules [sz.SzBlankWeb]
> [INFO] establishing classpath list (scope = compile)
> [INFO] Compiling module sz.SzBlankWeb
> [INFO] Compiling 6 permutations
> [INFO] Permutation compile succeeded
> [INFO] Linking into D:\workspaces\Pull\szBlankWeb\target\test-1.0-SNAPSHOT
> [INFO] Link succeeded
> [INFO] Compilation succeeded -- 9.547s
> [INFO] [resources:testResources]
> [INFO] Using default encoding to copy filtered resources.
> [INFO] [compiler:testCompile]
> [INFO] No sources to compile
> [INFO] [surefire:test]
> [INFO] Surefire report directory:
> D:\workspaces\Pull\szBlankWeb\target\surefire-reports
>
> -------------------------------------------------------
> T E S T S
> -------------------------------------------------------
> There are no tests to run.
>
> Results :
>
> Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
>
> [INFO] [war:war]
> [INFO] Packaging webapp
> [INFO] Assembling webapp[test] in
> [D:\workspaces\Pull\szBlankWeb\target\test-1.0-SNAPSHOT]
> [INFO] Processing war project
> [INFO] Copying webapp resources[D:\workspaces\Pull\szBlankWeb\war]
> [INFO] Webapp assembled in [156 msecs]
> [INFO] Building war:
> D:\workspaces\Pull\szBlankWeb\target\test-1.0-SNAPSHOT.war
> [INFO]
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESSFUL
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 14 seconds
> [INFO] Finished at: Tue Jul 21 13:40:48 EDT 2009
> [INFO] Final Memory: 5M/22M
> [INFO]
> ------------------------------------------------------------------------
> ************************************************************
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]