[ https://issues.apache.org/jira/browse/MWAR-344?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robert Scholte closed MWAR-344. ------------------------------- Resolution: Invalid Assignee: Robert Scholte This is actually a Maven core issue. Maven can perfectly merge almost every element of the pom.xml, except those within configuration, since these are plugin specific and Maven can't predict the representation of such a tag. The merging is done by simple xml rules, which work very well for primitives, Strings, Lists and Maps, but in case of an Object (such as Resource) they act more like an override (and in case of Lists, index-based overrides). http://maven.apache.org/pom.html#Plugins gives examples of some magic attributes (\@combine.children and \@combine.self), and I've been working on support for \@combine.id (https://github.com/sonatype/plexus-utils/issues/16) but that still needs to be added to the Maven distribution. Some similar issues: https://issues.apache.org/jira/issues/?jql=project%20%3D%20MNG%20AND%20text%20~%20%22configuration%20merge%22 > Webresources not properly configured when configuration is override in profile > ------------------------------------------------------------------------------ > > Key: MWAR-344 > URL: https://issues.apache.org/jira/browse/MWAR-344 > Project: Maven WAR Plugin > Issue Type: Bug > Affects Versions: 2.5, 2.6 > Environment: Apache Maven 3.0.5 > Reporter: Felix Martin > Assignee: Robert Scholte > Priority: Critical > Attachments: mwar-bug.zip > > > If in a profile you configure a webresource already configured as default > includes/excludes are mixed. > If default plugin configuration in pom is: > {code:xml} > <configuration> > <webResources> > <resource> > <directory>${basedir}/src/main/webapp2</directory> > <includes> > <include>**/*.txt</include> > </includes> > </resource> > <resource> > <directory>${basedir}/src/main/webapp3</directory> > <excludes> > <exclude>**/*.txt</exclude> > </excludes> > </resource> > </webResources> > </configuration> > {code} > The configuration in runtime with no profile is: > {noformat} > [DEBUG] (s) directory = W:\DESARROLLO\Workspaces\mwar-bug/src/main/webapp2 > [DEBUG] (s) includes = [**/*.txt] > [DEBUG] (s) directory = W:\DESARROLLO\Workspaces\mwar-bug/src/main/webapp3 > [DEBUG] (s) excludes = [**/*.txt] > [DEBUG] (s) webResources = [Resource {targetPath: null, filtering: false, > FileSet {directory: W:\DESARROLLO\Workspaces\mwar-bug/src/main/webapp2, > PatternSet [includes: {**/*.txt}, excludes: {}]}}, Resource {targetPath: > null, filtering: false, FileSet {directory: > W:\DESARROLLO\Workspaces\mwar-bug/src/main/webapp3, PatternSet [includes: {}, > excludes: {**/*.txt}]}}] > {noformat} > which works as expected. > If we add a profile named 'test' with the following configuration: > {code:xml} > <configuration> > <webResources> > <resource> > <directory>${basedir}/src/main/webapp4</directory> > <includes> > <include>**/*.txt</include> > </includes> > </resource> > </webResources> > </configuration> > {code} > The configuration in runtime with the profile 'test' is: > {noformat} > [DEBUG] (s) directory = W:\DESARROLLO\Workspaces\mwar-bug/src/main/webapp4 > [DEBUG] (s) includes = [**/*.txt] > [DEBUG] (s) webResources = [Resource {targetPath: null, filtering: false, > FileSet {directory: W:\DESARROLLO\Workspaces\mwar-bug/src/main/webapp4, > PatternSet [includes: {**/*.txt}, excludes: {}]}}] > {noformat} > which also works as expected. > But if we add anothjer profile named 'bug' with the following configuration: > {code:xml} > <configuration> > <webResources> > <resource> > <directory>${basedir}/src/main/webapp2</directory> > <includes> > <include>**/*.json</include> > </includes> > </resource> > <resource> > <directory>${basedir}/src/main/webapp4</directory> > <includes> > <include>**/*.txt</include> > </includes> > </resource> > </webResources> > </configuration> > {code} > The configuration in runtime with the profile 'bug' is: > {noformat} > [DEBUG] (s) directory = W:\DESARROLLO\Workspaces\mwar-bug/src/main/webapp2 > [DEBUG] (s) includes = [**/*.json] > [DEBUG] (s) directory = W:\DESARROLLO\Workspaces\mwar-bug/src/main/webapp4 > [DEBUG] (s) includes = [**/*.txt] > [DEBUG] (s) excludes = [**/*.txt] > [DEBUG] (s) webResources = [Resource {targetPath: null, filtering: false, > FileSet {directory: W:\DESARROLLO\Workspaces\mwar-bug/src/main/webapp2, > PatternSet [includes: {**/*.json}, excludes: {}]}}, Resource {targetPath: > null, filtering: false, FileSet {directory: > W:\DESARROLLO\Workspaces\mwar-bug/src/main/webapp4, PatternSet [includes: > {**/*.txt}, excludes: {**/*.txt}]}}] > {noformat} > As we can see configuration for directory 'webapp2' is ok, but the > configuration for directory 'webapp4' is mixed with configuration for > directory 'webapp3' in the default configuration. > An example project is attached. -- This message was sent by Atlassian JIRA (v6.3.4#6332)