I wanted to share some progress I've made in making things work
smoothly together.
First off, I discovered the new phase "prepare-package" in Maven
2.1.0. This is perfect for binding the gwt compile goal to. This means
the app gets compiled down to Javascript just before packaging, which
is exactly what you want. Hosted mode and unit tests don't require a
JS compile.
Second, I've got what appears to be a nice working solution involving
GWT-1.6.4 and maven, concerning the build path and src folder problem.
I've got GWT compiling into ${project.build.finalName} (this is
usually your artifact name... "/target/mywebapp-1.0"). Then, add this
to resources:
<resource>
<directory>src/main/webapp</directory>
<targetPath>${project.build.directory}/$
{project.build.finalName}</targetPath>
</resource>
What this does is overlay your source webapp to the target *before*
GWT gets started up (either Compiler or Hosted Mode). If you use the
m2eclipse plugin, then the resources goal is automatically executed
when you modify files.
This achives several important goals of mine:
Client java code changes are picked up immediately on the next
page reload (if you need resource filtering, put your java source in a
resource entry, and disable the "sourcesOnPath" option)
HostedMode is using a classpath containing target/classes (so any
modified servlet code can take effect with the reload server button)
No source tree pollution... a full clean is simply "rm -rf
target" (or more properly: mvn clean)
Packaging can still be controlled to filter out all uneccesary
files from the resulting WAR (.class and .java files from GWT client
side code, GWT module xml, etc)
I wish I had a place to put an example of all this (I need a blog or
something), but feel free to contact me if you'd like a sample of my
project if you can put this on a wiki and help document it, then I can
point people to a URL instead of clogging up mailing lists ;-)
Hope this helps people... big thanks to everyone else who's worked on
this already...
On Apr 19, 8:56 am, Mark Renouf <[email protected]> wrote:
> The thing I'd not like to lose, is "live-edit" capability. ie: changes
> take effect with a simple page reload in HostedMode (and also Restart
> Server button in 1.6).
>
> I think GWT provides enough options to make things work, but it's
> harder than it should be. If I had a magic wand though, I'd say having
> "war dir overlay" parameter would make life much simpler. If it could
> do this, and still detect changes to the source, that would be sweet.
> You'd just set -warOverlay /src/main/webapp -war /target/$
> {project.build.finalName} That actually wouldn't effect existing users
> one bit. Actually... maybe I should work on a patch and submit it to
> GWT, you never know ;-)
>
> On Apr 16, 2:00 pm, Matt Bishop <[email protected]> wrote:
>
> > One of the big wins withMavenis the "rigid" directory structure,
> > where source files of all stripes are in src/ and build outputs are in
> > target/. It's good practice because it doesn't allow for intermingling
> > source files and build files.
>
> > The new GWT war/ dir next to src/ problematic because you have to be
> > careful how you clean up. I can see many an "aaargh!" being screamed
> > out in the early morning hours when a tired developer discovers a bug
> > in her ant script, or when he trashes the war/ dir accidentally.
>
> > I would much rather have seen src/java and src/war (better yet, src/
> > webapp) and the HostedMode compiler would copy src/webapp to war/
> > before compilation. It would be a whole lot safer and wouldn't really
> > cost that much, even for large projects with a whole lotta webapp/**
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---