Maven Eclipse Plugin
  1. Maven Eclipse Plugin
  2. MECLIPSE-704

Request to merge when 'filtering' is not identical

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.7, 2.8
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Testcase included:
      yes
    • Number of attachments :
      1

      Description

      mvn eclipse:eclipse fails with a "Request to merge when 'filtering' is not identical" message. There is a discussion about this on the internet and the accepted workaround is to user eclipse plugin 2.6 (see http://forums.atlassian.com/thread.jspa?threadID=34952)

      In my case it is happening with non standard maven directory structure. The parent pom has the config in the attached parent_pom.txt file.

        Activity

        Hide
        Dmitry Katsubo added a comment -

        I have the same issue for the following case: I would like *.properties resources to be filtered, any other resources to stay unfiltered.

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

        Resulting error:

        [ERROR] Failed to execute goal org.apache.maven.plugins:maven-eclipse-plugin:2.8:eclipse (default-cli) on project service-extractor: Request to merge when 'filtering' is not identical. Original=resource src/main/resources: output=bin, include=[**/*.properties], exclude=[**/*.java], test=false, filtering=true, merging with=resource src/main/resources: output=bin, include=[], exclude=[**/*.properties|**/*.java], test=false, filtering=false -> [Help 1]

        Show
        Dmitry Katsubo added a comment - I have the same issue for the following case: I would like *.properties resources to be filtered, any other resources to stay unfiltered. <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> </build> Resulting error: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-eclipse-plugin:2.8:eclipse (default-cli) on project service-extractor: Request to merge when 'filtering' is not identical. Original=resource src/main/resources: output=bin, include= [**/*.properties] , exclude= [**/*.java] , test=false, filtering=true, merging with=resource src/main/resources: output=bin, include=[], exclude= [**/*.properties|**/*.java] , test=false, filtering=false -> [Help 1]
        Hide
        Benjamin Leipold added a comment -

        Solving this issue would be great since the snippet provided by Dmitry Katsubo is a recommended approach (see http://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html).

        Show
        Benjamin Leipold added a comment - Solving this issue would be great since the snippet provided by Dmitry Katsubo is a recommended approach (see http://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html ).
        Hide
        Dmitry Katsubo added a comment -

        For me personally the following solution would be OK:

        • If there is only one resource entry for the given directory, then map <includes>/<excludes> to corresponding settings in .classpath preserving the semantics.
        • If there are several resource entries, then assume
          **/*

          mask for including and

          **/*.java

          for excluding (it's not trivial to compute the exact mask).

        Show
        Dmitry Katsubo added a comment - For me personally the following solution would be OK: If there is only one resource entry for the given directory, then map <includes>/<excludes> to corresponding settings in .classpath preserving the semantics. If there are several resource entries, then assume **/* mask for including and **/*.java for excluding (it's not trivial to compute the exact mask).
        Hide
        Benjamin Leipold added a comment -

        By the way, what is the problem with different filter settings? This is only a maven feauter to replace properties when copying ressources, isn't it? This feature is not available in Eclipse, so it doesn't matter if they are not identical. Eclipse always simply copies the resources without replacing any properties. Or did i missed an eclipse feature all the years?

        Show
        Benjamin Leipold added a comment - By the way, what is the problem with different filter settings? This is only a maven feauter to replace properties when copying ressources, isn't it? This feature is not available in Eclipse, so it doesn't matter if they are not identical. Eclipse always simply copies the resources without replacing any properties. Or did i missed an eclipse feature all the years?
        Hide
        Dmitry Katsubo added a comment -

        Benjamin, you're right: Eclipse does not support any filtering. But maven-eclipse-plugin needs to calculate the include/exclude masks for the resource based on two (or maybe more) sections in Maven POM. I think this is a showstopper, but I might be wrong. It is not straightforward, e.g. for two entries I've posted in my 1st comment #287007 the following inferred result does not make sense:

        include=[**/*.properties], exclude=[**/*.properties]
        

        Your suggestion concerning the algo is welcomed.

        Show
        Dmitry Katsubo added a comment - Benjamin, you're right: Eclipse does not support any filtering. But maven-eclipse-plugin needs to calculate the include/exclude masks for the resource based on two (or maybe more) sections in Maven POM. I think this is a showstopper, but I might be wrong. It is not straightforward, e.g. for two entries I've posted in my 1st comment #287007 the following inferred result does not make sense: include=[**/*.properties], exclude=[**/*.properties] Your suggestion concerning the algo is welcomed.
        Hide
        Benjamin Leipold added a comment -

        That's because the inferred result is wrong. Since eclipse does not support filtering, you have to remove those entries and take a look at maven's result. All *.properties files should be copied to the target directory. So, the correct inferred result should look like this:

        <classpathentry kind="src" path="src/main/resources"/>
        
        Show
        Benjamin Leipold added a comment - That's because the inferred result is wrong. Since eclipse does not support filtering, you have to remove those entries and take a look at maven's result. All *.properties files should be copied to the target directory. So, the correct inferred result should look like this: <classpathentry kind="src" path="src/main/resources"/>

          People

          • Assignee:
            Unassigned
            Reporter:
            Paul Mackinlay
          • Votes:
            4 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated: