mvn eclipse:eclipse fails or doesn't generate proper .classpath when specifying the same resource directory with different filtering rules ------------------------------------------------------------------------------------------------------------------------------------------
Key: MECLIPSE-622 URL: http://jira.codehaus.org/browse/MECLIPSE-622 Project: Maven 2.x Eclipse Plugin Issue Type: Bug Components: Core : Dependencies resolution and build path (.classpath) Affects Versions: 2.6, 2.7 Environment: GNU/Linux (Ubuntu 9.10), Java 6u16, maven 2.2.1 Reporter: Pascal Thivent Attachments: maven-eclipse-plugin-resources-testcase.zip Let's say I have a resource directory ({{src/main/resources}}) that contains properties and XML and want to filter {{.properties}} only. My pom.xml is setup as follow: {code:xml} <build> <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> <includes> <include>**/*.properties</include> </includes> </resource> <resource> <directory>src/main/resources</directory> <filtering>false</filtering> <excludes> <exclude>**/*.properties</exclude> </excludes> </resource> </resources> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-eclipse-plugin</artifactId> <version>2.7</version> </plugin> </plugins> </build> {code} This works fine when running maven on the command line. However, when I run {{mvn eclipse:eclipse}} with the eclipse plugin 2.7, the build just fails: {code} [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Request to merge when 'filtering' is not identical. Original=resource src/main/resources: output=target/classes, include=[**/*.properties], exclude=[**/*.java], test=false, filtering=true, merging with=resource src/main/resources: output=target/classes, include=[], exclude=[**/*.properties|**/*.java], test=false, filtering=false [INFO] ------------------------------------------------------------------------ [INFO] For more information, run Maven with the -e switch [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2 seconds [INFO] Finished at: Wed Nov 25 18:47:32 CET 2009 [INFO] Final Memory: 8M/79M [INFO] ------------------------------------------------------------------------ {code} With the maven eclipse plugin version 2.6, the build passes but the {{.classpath}} doesn't contain the expected informations in the {{including}} attribute of the classpathentry {{src/main/resources}}, XML files are not included in the actual result: {{code:xml}} <classpath> <classpathentry kind="src" path="src/test/java" output="target/test-classes" including="**/*.java"/> <classpathentry kind="src" path="src/main/java" including="**/*.java"/> <classpathentry kind="src" path="src/main/resources" including="**/*.properties" excluding="**/*.java"/> <classpathentry kind="output" path="target/classes"/> <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar" sourcepath="M2_REPO/junit/junit/3.8.1/junit-3.8.1-sources.jar"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> </classpath> {{code}} I'm not really sure what the expected result should be (should the union of {{**/*.properties}} and all other files that are not {{**/*.properties}} be {{**/*.*}}?) but the actual result is not correct. Specifying sourceIncludes/sourcesExcludes (as documented [here|http://maven.apache.org/plugins/maven-eclipse-plugin/examples/specifying-source-path-inclusions-and-exclusions.html] doesn't help (and it's not clear to me if it's the right things to do). For now, I'm using the following setup (I've split filtered and non filtered resources into separate directories) as workaround: {{code:xml}} <resources> <resource> <directory>src/main/resources1</directory> <filtering>true</filtering> <includes> <include>**/*.properties</include> </includes> </resource> <resource> <directory>src/main/resources2</directory> <filtering>false</filtering> <includes> <include>**/*.xml</include> </includes> </resource> </resources> {{code}} But still, there is clearly a regression between versions prior to 2.7 and 2.7. I'm attaching a project allowing to reproduce this. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira