Uploaded image for project: 'Maven Eclipse Plugin (RETIRED)'
  1. Maven Eclipse Plugin (RETIRED)
  2. MECLIPSE-621

mvn eclipse:eclipse fails or doesn't generate proper .classpath when specifying the same resource directory with different filtering rules

    XMLWordPrintableJSON

Details

    Description

      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:

       
        <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>
      

      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:

      [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] ------------------------------------------------------------------------
      

      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 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.

      Attachments

        Issue Links

          Activity

            People

              fgiust Fabrizio Giustina
              pthivent Pascal Thivent
              Votes:
              4 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: