gwt plugin and filtering resources

363 views
Skip to first unread message

MiSt

unread,
Oct 2, 2008, 5:46:31 AM10/2/08
to gwt-maven
I have ${project.version} in my host html page and I want maven to
replace this variable so I've put
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
</resource>

In pom.xml
It did work with some older version od gwt maven plugin but with beta
23 it doesn't work.

How can I filter gwt module public resources ?

Mirko Nasato

unread,
Oct 2, 2008, 5:55:27 AM10/2/08
to gwt-...@googlegroups.com
AFAIK filtering is done by the standard maven-resources-plugin, not by gwt-maven.

  http://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html

Cheers

Mirko


2008/10/2 MiSt <mi...@mist.pl>

MiSt

unread,
Oct 2, 2008, 7:12:02 AM10/2/08
to gwt-maven
I know, but it looks like gwt maven plugin overwrites filtered
resources.
In target/classes file is filtered but in target/warname/
gwtModuleName/ no.

On 2 Paź, 11:55, "Mirko Nasato" <mirko.nas...@gmail.com> wrote:
> AFAIK filtering is done by the standard maven-resources-plugin, not by
> gwt-maven.
>
> http://maven.apache.org/plugins/maven-resources-plugin/examples/filte...
>
> Cheers
>
> Mirko
>
> 2008/10/2 MiSt <m...@mist.pl>

Charlie Collins

unread,
Oct 2, 2008, 7:26:27 AM10/2/08
to gwt-maven
GWT-Maven doesn't overwrite anything, in fact, it doesn't put anything
at ALL in the "warname" directory on it's own.

MiSt

unread,
Oct 2, 2008, 7:45:37 AM10/2/08
to gwt-maven
Ok, I know were is the problem but I don't know how to fix it.
In target/run.sh "(..)src/main/resources" directory is before
"(...)target/classes"
so when GWT searches file it takes version from resources which is
not filtered. When I have edited run.sh and put target/classes before
resources it works. I think than maven gwt shouldn't put resources
directory in the classpath because all resources are copied to target/
classes

MiSt

unread,
Oct 2, 2008, 8:18:32 AM10/2/08
to gwt-maven
I have commented out lines 83-86 BuildClasspathUtil:

// for (Iterator it = project.getResources().iterator();
it.hasNext();) {
// Resource r = (Resource) it.next();
// items.add(new File(r.getDirectory()));
// }

And this solved my problems. Are there any reasons why this lines are
necessarry ?

MiSt

unread,
Oct 2, 2008, 9:17:18 AM10/2/08
to gwt-maven
> And this solved my problems. Are there any reasons why this lines are
> necessarry ?

Ok, I can answer my own question ;).

Thanks to resources dir at classpath you can edit css files and see
changes without gwt browser restart.

Charlie Collins

unread,
Oct 2, 2008, 1:01:34 PM10/2/08
to gwt-maven
Yes, there are a few other types of resources that may be necessary
too (other stuff the shell needs, for server side resources, etc).

I will look into this more though, I thought the regular filtering via
the webapp plugin still worked for WARs (who cares what's in the
shell, as long as it works, but deployment artifacts do need to be
clean).

What setup did you try to filter the resources?

I believe if you do something like this to configure the WAR plugin,
it works fine?

<webResources>
<resource>
<directory>target/gwt</directory>
<excludes>
<!-- Filter out unwanted build artifacts -->
<exclude>**/whatever/**</exclude>
</excludes>
</resource>
</webResources>

Maybe it would be sufficient to add that to the FAQ? Try that please,
if you haven't, and let me know if it accomplishes what you are trying
to do.

Charlie Collins

unread,
Oct 2, 2008, 2:28:13 PM10/2/08
to gwt-maven
I am adding this to the tracker, I tried filtering a few ways, and
indeed, I end up with the .gwt-tmp files in my WAR. And, I stand
corrected on GWT-Maven not outputting anything to the war dir. It
does. Really the GWTCompiler does, the .gwt-tmp files end up there
because they are part of the -out location which itself defaults to
the webappLocation. For example: -out /data/ccollins/projects/maven-
googlewebtoolkit2-plugin/sim
plesample/target/maven-gwt-sample-1.0-SNAPSHOT.

I will add this to the tracker and spend more time on it at some
point.

Right now though, I am trying to write an Android book that is due in
two weeks, outside of my "day job" ;) - so any help would be greatly
appreciated.

Charlie Collins

unread,
Oct 2, 2008, 2:37:36 PM10/2/08
to gwt-maven
One more spam from me, I got this to work, would this suffice:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webXml>target/web.xml</webXml>
<warSourceExcludes>.gwt-tmp/**</
warSourceExcludes>
</configuration>
</plugin>


Note that you have to have war plugin 2.0.1 or 2.1 alpha for the
"warSourceExcludes" param to work, with 2.0 it seems to not get
applied.

MiSt

unread,
Oct 7, 2008, 4:40:01 AM10/7/08
to gwt-maven
On Oct 2, 8:37 pm, Charlie Collins <charlie.coll...@gmail.com> wrote:
> One more spam from me, I got this to work, would this suffice:
>
> <plugin>
>                                 <groupId>org.apache.maven.plugins</groupId>
>                                 <artifactId>maven-war-plugin</artifactId>
>                                 <configuration>
>                                         <webXml>target/web.xml</webXml>
>                     <warSourceExcludes>.gwt-tmp/**</
> warSourceExcludes>
>                                 </configuration>
>                         </plugin>
>

This works for me.

Thanks.

AndyW

unread,
Oct 30, 2008, 12:34:56 PM10/30/08
to gwt-maven
Hi,

I'm sorry if I'm being dense, but this doesn't work for me - I'd
appreciate it if someone can give me a pointer?

I'm attempting virtually the same thing as MiST. I have a ${key} in an
html file, and I'm filtering this with the normal maven resource
filtering.

The war file that gets built contains my html file in two places: WEB-
INF\classes, where it is correctly filtered; and the gwt module
folder, where the file isn't filtered.

As far as I can tell, doing a warSourceExcludes (or packagingExcludes)
of .gwt-tmp/** only prevents that folder from being added to the war
file - useful, but it doesn't help with the filtering problem.

Any clues on this very appreciated! I'm using maven-war-plugin 2.1-
alpha-2, and maven-googlewebtoolkit2-plugin 2.0-beta19. (Replying to
thread at http://groups.google.com/group/gwt-maven/browse_thread/thread/f34ee542f3f30e0b).

Thanks,
Andy.
Reply all
Reply to author
Forward
0 new messages