You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Markward Schubert <ma...@gmail.com> on 2013/11/05 17:07:12 UTC

Some help needed with maven-enforcer-plugin

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

Re: Some help needed with maven-enforcer-plugin

Posted by Markward Schubert <ma...@gmail.com>.
Thanks Paul,

ahh, I think I really misunderstood the docs.
The dependencies tag refers to dependencies of plugins, instead of
depenencies of the project.

Thanks!


2013/11/5 Paul Benedict <pb...@apache.org>

> 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.schubert@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
>

Re: Some help needed with maven-enforcer-plugin

Posted by Paul Benedict <pb...@apache.org>.
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.schubert@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

Re: Some help needed with maven-enforcer-plugin

Posted by Robert Scholte <rf...@apache.org>.
This is indeed the expected configuration, so you might have hit a bug.

Robert

Op Tue, 05 Nov 2013 17:07:12 +0100 schreef Markward Schubert  
<ma...@gmail.com>:

> 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

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