Maven resource filtering: Eclipse ignores exclude pattern?

1,095 views
Skip to first unread message

Jens

unread,
Nov 30, 2012, 12:08:09 PM11/30/12
to codehaus-mojo-gwt-...@googlegroups.com
Hi,

its more of a general Maven/Eclipse question but maybe someone here already stumbled upon this. Googling doesn't really helped me so far.

I have created a multi module project based on gwt-maven-archetypes with some modifications and now I want to do Maven resource filtering in my server project to filter some property files for production/dev environments. I have src/main/resources as source folder and Eclipse is configured to exclude everything in that source folder (exclude pattern '**' in build path settings). Makes total sense to me as Maven will process the resources in order to be able to filter them.

When I run jetty:run on my server project everything works fine (resources are filtered) but as soon as I modify a class in the server project (or open a file in the resource folder with Eclipse) Eclipse copies everything from src/main/resources to target/classes and overwrites my filtered resources with the non filtered versions. Now jetty redeploys the server code  because target/classes has changed and well obviously its broken now. Also when running mvn clean the target folder gets deleted, Eclipse recompiles files and then copies all resources. So after a mvn clean I end up with class files and (unfiltered) resources in target/classes.

Looks like Eclipse is ignoring the exclude pattern in the build path settings. The projects .classpath file contains a classpath entry with 'excluding="**"' so it seems correct to me. I also tried to use * or */** or directly exclude a specific file like app.properties but it has no effect at all. Eclipse always copies everything in src/main/resources to target/classes when it thinks it needs to.

Has anyone else seen this behavior with Maven and Eclipse? As I am relatively new to maven, maybe I have missed some configuration in Eclipse? 

I am on Mac OS 10.8.2 and Eclipse Juno SR 1.

I would really appreciate some input/help.

Thanks in advance.

-- J.

Olivier NOUGUIER

unread,
Nov 30, 2012, 1:20:05 PM11/30/12
to codehaus-mojo-gwt-...@googlegroups.com
Hi,
  You right that rather an eclipse/m2e question ;-)
   Are you using the m2e-wtp plugins ? AFAIK it works well with tomcat.
   Also remember that a (console) mvn clean will put eclipse in trouble ...
HIH
 



-- J.

--
You received this message because you are subscribed to the Google Groups "Codehaus Mojo gwt-maven-plugin Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/codehaus-mojo-gwt-maven-plugin-users/-/DvlSiTG-zycJ.
To post to this group, send email to codehaus-mojo-gwt-...@googlegroups.com.
To unsubscribe from this group, send email to codehaus-mojo-gwt-maven-...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/codehaus-mojo-gwt-maven-plugin-users?hl=en.



--
"Computers are useless. They can only give you answers."
- Pablo Picasso -

Jens

unread,
Dec 1, 2012, 5:47:19 PM12/1/12
to codehaus-mojo-gwt-...@googlegroups.com
I dont have m2e-wtp installed as I only use the Java IDE not the J2EE IDE of Eclipse.

But I guess it was just me forgetting things in the pom.xml and Eclipse configuration. 

First, my pom has one profile called "dev" and I forgot to add filtering when no profile is active. Second, I have run jetty:start through Eclipse and added the dev profile in the run configuration manually. Sadly I forgot to tell Eclipse that Eclipse itself should use the "dev" profile by default. So after starting Jetty things look ok, but when modifying files Eclipse executes maven with no active profile instead of the "dev" profile. 

Well and in that case the non-configured resource filtering does the rest to drive me nuts :-)

Is it common practice to manually activate a default profile inside an IDE or can I somehow save this fact in pom.xml? Something like "When opening this project in any IDE try to use "dev" profile as default".

-- J.

Reply all
Reply to author
Forward
0 new messages