You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Jason Thrasher (JIRA)" <ji...@codehaus.org> on 2010/01/18 08:27:55 UTC

[jira] Commented: (MECLIPSE-621) mvn eclipse:eclipse fails or doesn't generate proper .classpath when specifying the same resource directory with different filtering rules

    [ http://jira.codehaus.org/browse/MECLIPSE-621?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=207264#action_207264 ] 

Jason Thrasher commented on MECLIPSE-621:
-----------------------------------------

There's a quickie workaround here that tells maven to use v2.6 of the plugin, regardless of the pom-specified version configuration:
http://mentalecho.com/blog/tag/Eclipse

However, I'd like my team to not have to make those kinds of changes, as lots of other issues are then introduced.  For right now our workaround is to configure one filtered, and one non-filtered, directory as:
src/main/resources
src/main/resources-filtered


> mvn eclipse:eclipse fails or doesn't generate proper .classpath when specifying the same resource directory with different filtering rules
> ------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: MECLIPSE-621
>                 URL: http://jira.codehaus.org/browse/MECLIPSE-621
>             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