You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Dirk Olmes <di...@xanthippe.ping.de> on 2007/04/05 14:53:23 UTC

Adding the same resource dir in a profile ends up twice in the effective pom

Hi,

I have a pom that declares the resources in a build section and
re-declares the same resource directory in a profile, albeit with excludes.

Example:

<project ...>
  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
    </resources>
  </build>

  <profiles>
    <profile>
      <id...>
      <build>
        <resources>
          <resource>
            <directory>src/main/resources</directory>
            <excludes>....</excludes>
          </resource>
        </resources>
      </build>
    </profile>
  </profiles>
</project

If I run help:effective-pom with the profile activated, I see the
resource directory added twice: one time without the excludes and one
time with the excludes. The resources plugin seems to pick up only the
first entry, effectively ignoring the filter.

Am I the only one who thinks that this behaviour is unexpected at least?
Should I file a Jira?

-dirk

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Adding the same resource dir in a profile ends up twice in the effective pom

Posted by Dirk Olmes <di...@xanthippe.ping.de>.
franz see wrote:
> Good day to you, dir,

Hi Franz,

> If you do this ( your pom resources setup without the profiles )
> 
> <project>
>   <build>
>     <resources>
>       <resource>
>         <directory>src/main/resources</directory>
>       </resource>
>     </resources>
>     <resources>
>       <resource>
>         <directory>src/main/resources</directory>
>         <excludes>
>           <exclude>...</exclude>
>         </excludes>
>       </resource>
>     </resources>
>   </build>
> </project>

That's what I get when I run mvn -X with the profile enabled, ok.

> Maven resources plugin would copy everything from src/main/resources on one
> pass, and will copy everything from src/main/resources except those you
> specified in your excludes in the second. Hence, the end result is that
> everything gets copied.
> 
> If you find this behaviour odd, please feel free to file a jira issue :-)

Yes I do find it odd, because when I re-declare dependencies in a
profile that are also listed in the main dependencies section, the
profile "wins". I would have expected that re-declaring *the same*
resource dir would overwrite it.

See http://jira.codehaus.org/browse/MNG-2933

-dirk

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Adding the same resource dir in a profile ends up twice in the effective pom

Posted by franz see <fr...@gmail.com>.
Good day to you, dir,

If you do this ( your pom resources setup without the profiles )

<project>
  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
    </resources>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <excludes>
          <exclude>...</exclude>
        </excludes>
      </resource>
    </resources>
  </build>
</project>

Maven resources plugin would copy everything from src/main/resources on one
pass, and will copy everything from src/main/resources except those you
specified in your excludes in the second. Hence, the end result is that
everything gets copied.

If you find this behaviour odd, please feel free to file a jira issue :-)

Cheers,
Franz


Dirk Olmes wrote:
> 
> Hi,
> 
> I have a pom that declares the resources in a build section and
> re-declares the same resource directory in a profile, albeit with
> excludes.
> 
> Example:
> 
> <project ...>
>   <build>
>     <resources>
>       <resource>
>         <directory>src/main/resources</directory>
>       </resource>
>     </resources>
>   </build>
> 
>   <profiles>
>     <profile>
>       <id...>
>       <build>
>         <resources>
>           <resource>
>             <directory>src/main/resources</directory>
>             <excludes>....</excludes>
>           </resource>
>         </resources>
>       </build>
>     </profile>
>   </profiles>
> </project
> 
> If I run help:effective-pom with the profile activated, I see the
> resource directory added twice: one time without the excludes and one
> time with the excludes. The resources plugin seems to pick up only the
> first entry, effectively ignoring the filter.
> 
> Am I the only one who thinks that this behaviour is unexpected at least?
> Should I file a Jira?
> 
> -dirk
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Adding-the-same-resource-dir-in-a-profile-ends-up-twice-in-the-effective-pom-tf3531428s177.html#a9856065
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org