I looked up the ticket that introduced the feature:
http://jira.codehaus.org/browse/MENFORCER-147

It doesn't look like it enforces dependency versions; it enforces that
Maven plugin versions in <build> match <reporting>.

Paul



On Tue, Nov 5, 2013 at 10:07 AM, Markward Schubert <
markward.schub...@gmail.com> wrote:

> Hi All!
>
> I am struggling with the enforcer-plugin's requireSameVersions rule.
> Introducing the bannedDependencies rule was successful, but somehow I seem
> to not get the right configuration for requireSameVersion.
>
> Here is my config:
>
> <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-enforcer-plugin</artifactId>
>                 <version>1.3.1</version>
>                 <executions>
>                     <execution>
>                         <id>enforce-banned-dependencies</id>
>                         <goals>
>                             <goal>enforce</goal>
>                         </goals>
>                         <configuration>
>                             <rules>
>                                 <bannedDependencies>
>
> <searchTransitive>true</searchTransitive>
>                                     <excludes>
>                                         <exclude>commons-logging</exclude>
>                                     </excludes>
>                                 </bannedDependencies>
>                             </rules>
>                             <fail>true</fail>
>                         </configuration>
>                     </execution>
>                     <execution>
>                         <id>enforce-same-versions</id>
>                         <goals>
>                             <goal>enforce</goal>
>                         </goals>
>                         <configuration>
>                             <rules>
>                                 <requireSameVersions>
>                                     <dependencies>
>
> <dependency>org.slf4j:*</dependency>
>                                     </dependencies>
>                                 </requireSameVersions>
>                             </rules>
>                             <fail>true</fail>
>                         </configuration>
>                     </execution>
>                 </executions>
>                 <configuration>
>                     <ignoreCache>true</ignoreCache>
>                 </configuration>
>             </plugin>
>
> As a matter of fact we have
>
> org.slf4j:slf4j-api:1.7.5
>
> as well as
>
> org.slf4j:com.springsource.slf4j.api:1.6.1
>
> in our dependency tree. But still the build is SUCCESSFUL.
> Did I get anything wrong here? Some misconfiguration.
>
> I would expect that the rule as configured would enforce all
> org.slf4j-group dependencies to have the same version.
>
> Thanks for your help!
>
> Markward
>



-- 
Cheers,
Paul

Reply via email to