Maven 2.x Eclipse Plugin

Several resource directories with different includes and eclipse

Details

  • Number of attachments :
    1

Description

I define the resources like this in my project :

<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>p1.properties</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<includes>
<include>p2.properties</include>
</includes>
</resource>
</resources>

Then I execute the maven-eclipse-plugin to generate the .classpath and .project file.

The result is not why I expected :

  • only the first resource definition is taken into account (see screenshot)
    > the file p2.properties is not copied by the eclipse build mechanism.

Proposed solution:
When we define 2 resource definition on the same 'directory', the 'maven-eclipse-plugin' should merge the includes and excludes elements.

Activity

Hide
Andreas Höhmann added a comment -

it would be nice if anybody can fix this issue ... eclipse:eclipse is not useable if more than one resource (with filter) is defined
i thing the fix can not be so hard ?!

Show
Andreas Höhmann added a comment - it would be nice if anybody can fix this issue ... eclipse:eclipse is not useable if more than one resource (with filter) is defined i thing the fix can not be so hard ?!
Hide
Andreas Höhmann added a comment -

Here is another example of resources:

<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
<includes>
<include>*/.properties</include>
</includes>
</testResource>
<testResource>
<directory>src/test/resources</directory>
<filtering>false</filtering>
<includes>
<include>*/.xml</include>
<include>*/.DTD</include>
<include>db/*</include>
</includes>
</testResource>

the eclipse-project only includes */.properties

Show
Andreas Höhmann added a comment - Here is another example of resources: <testResource> <directory>src/test/resources</directory> <filtering>true</filtering> <includes> <include>*/.properties</include> </includes> </testResource> <testResource> <directory>src/test/resources</directory> <filtering>false</filtering> <includes> <include>*/.xml</include> <include>*/.DTD</include> <include>db/*</include> </includes> </testResource> the eclipse-project only includes */.properties
Hide
Andreas Höhmann added a comment -

Actual:
<classpathentry kind="src" path="src/test/resources" output="target/test-classes" including="*/.properties" excluding="*/.java"/>

Expected:
<classpathentry kind="src" path="src/test/resources" output="target/test-classes" including="*/.properties|*/.xml|*/.DTD|db/" excluding="/.java"/>

Show
Andreas Höhmann added a comment - Actual: <classpathentry kind="src" path="src/test/resources" output="target/test-classes" including="*/.properties" excluding="*/.java"/> Expected: <classpathentry kind="src" path="src/test/resources" output="target/test-classes" including="*/.properties|*/.xml|*/.DTD|db/" excluding="/.java"/>
Hide
Fredrik Wendt added a comment -

I ran across a similar example where WTP was tricked by eclipse:eclipse but mvn package built working package artifacts (a war project):

<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>filterMe.properties</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<excludes>
<exclude>filterMe.properties</exclude>
</excludes>
</resource>
</resources>

This will generate <classpathentry ... including="filterMe.properties" excluding="*/.java"/> which leads to Web Tools Project only exporting filterMe.properties and skipping other files. The war file created in mvn clean package on the other hand will properly include all files in src/main/resources.

Show
Fredrik Wendt added a comment - I ran across a similar example where WTP was tricked by eclipse:eclipse but mvn package built working package artifacts (a war project):
<resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> <includes> <include>filterMe.properties</include> </includes> </resource> <resource> <directory>src/main/resources</directory> <filtering>false</filtering> <excludes> <exclude>filterMe.properties</exclude> </excludes> </resource> </resources>
This will generate <classpathentry ... including="filterMe.properties" excluding="*/.java"/> which leads to Web Tools Project only exporting filterMe.properties and skipping other files. The war file created in mvn clean package on the other hand will properly include all files in src/main/resources.
Hide
Andreas Höhmann added a comment -

i would try to fix this issue but i need some advice ... how can i start?

Show
Andreas Höhmann added a comment - i would try to fix this issue but i need some advice ... how can i start?
Hide
Benjamin Bentmann added a comment -

Just checkout the sources (but replace tags/... with maven-eclipse-plugin in the given URLs, i.e. patch trunk and not the tag) and hack your way. Be sure to also provide a test case that proves your patch is functional.

Show
Benjamin Bentmann added a comment - Just checkout the sources (but replace tags/... with maven-eclipse-plugin in the given URLs, i.e. patch trunk and not the tag) and hack your way. Be sure to also provide a test case that proves your patch is functional.
Hide
Andreas Höhmann added a comment -

I try to document the setup for eclipse in my blog
http://ahoehma.wordpress.com/2008/11/16/hacking-maven-eclipse-plugin-with-eclipse-ide/

I guess the right place is the method extractResourceDirs in EclipsePlugin (line 1430) ...
there is a comment

// TODO: figure out how to merge if the same dir is specified twice
// with different in/exclude patterns.

Where is the right place for "discussions", e.g. how we can implement such a merge-algorithm?

Show
Andreas Höhmann added a comment - I try to document the setup for eclipse in my blog http://ahoehma.wordpress.com/2008/11/16/hacking-maven-eclipse-plugin-with-eclipse-ide/ I guess the right place is the method extractResourceDirs in EclipsePlugin (line 1430) ... there is a comment // TODO: figure out how to merge if the same dir is specified twice // with different in/exclude patterns. Where is the right place for "discussions", e.g. how we can implement such a merge-algorithm?

People

  • Assignee:
    Unassigned
    Reporter:
    ol
Vote (6)
Watch (6)

Dates

  • Created:
    Updated: