You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Marco Beelen <MB...@iprofs.nl> on 2009/12/17 12:09:11 UTC

enforce dependency to be set to provided

Hello,

For my portal I'm going to write various web-application and I want them to reuse various libraries provided by my portal server. All the webapp project have the same parent. In order to prevent the webapps to include the dependency in the WEB-INF\lib, I wan't to configure a rule in the parent pom, where I ban some library (log4j:log4j). The webapp are allowed to use the dependency, but only when the scope is set to provided.

I tried the bannedDependency configuration like this:


<bannedDependencies>

  <searchTransitive>true</searchTransitive>

  <excludes>

    <exclude>log4j:log4j</exclude>

  </excludes>

  <includes>

    <include>log4j:log4j:*:provided</include>

  </includes>

</bannedDependencies>


That doesn't work, because when I build a webapp with the log4j dependency on compile scope, the enforcer plugin doesn't cause my build to fail, which I would like it to.

Any suggestions how to handle this?

With kind regards,
    Marco


Marco Beelen
Software-architect
+31(0)6 55 145 554

IPROFS
Claus Sluterweg 125
2012 WS Haarlem
www.iprofs.nl<http://www.iprofs.nl/>
+31 (0)23 547 6369




Re: enforce dependency to be set to provided

Posted by Baptiste MATHUS <ml...@batmat.net>.
This doesn't work. Scope cannot be specified yet.
Please see http://jira.codehaus.org/browse/MENFORCER-72

Cheers.

2009/12/17 Marco Beelen <MB...@iprofs.nl>

> Hello,
>
> For my portal I'm going to write various web-application and I want them to
> reuse various libraries provided by my portal server. All the webapp project
> have the same parent. In order to prevent the webapps to include the
> dependency in the WEB-INF\lib, I wan't to configure a rule in the parent
> pom, where I ban some library (log4j:log4j). The webapp are allowed to use
> the dependency, but only when the scope is set to provided.
>
> I tried the bannedDependency configuration like this:
>
>
> <bannedDependencies>
>
>  <searchTransitive>true</searchTransitive>
>
>  <excludes>
>
>    <exclude>log4j:log4j</exclude>
>
>  </excludes>
>
>  <includes>
>
>    <include>log4j:log4j:*:provided</include>
>
>  </includes>
>
> </bannedDependencies>
>
>
> That doesn't work, because when I build a webapp with the log4j dependency
> on compile scope, the enforcer plugin doesn't cause my build to fail, which
> I would like it to.
>
> Any suggestions how to handle this?
>
> With kind regards,
>    Marco
>
>
> Marco Beelen
> Software-architect
> +31(0)6 55 145 554
>
> IPROFS
> Claus Sluterweg 125
> 2012 WS Haarlem
> www.iprofs.nl<http://www.iprofs.nl/>
> +31 (0)23 547 6369
>
>
>
>


-- 
Baptiste <Batmat> MATHUS - http://batmat.net
Sauvez un arbre,
Mangez un castor !