You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Borut Bolčina <bo...@gmail.com> on 2009/10/20 11:39:23 UTC

I would like build to fail

Hi,

if in parent pom (company POM for example):

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.acme</groupId>
            <artifactId>coyote-tornado-kit</artifactId>
            <version>[1.0.0]</version>
        </dependency>
</dependencyManagement>

and in some project:

<dependencies>
    <dependency>
        <groupId>com.acme</groupId>
        <artifactId>coyote-tornado-kit</artifactId>
        <version>[2.0.0]</version>
    </dependency>
</dependencies>

then I would expect build to fail becouse hard versions are used. Why is
that not so?

-Borut

Re: I would like build to fail

Posted by Brett Porter <br...@apache.org>.
dependencyManagement applies the settings to all dependencies - so  
you've effectively declared all dependencies to be [1.0.0].

- Brett

On 20/10/2009, at 8:39 PM, Borut Bolčina wrote:

> Hi,
>
> if in parent pom (company POM for example):
>
> <dependencyManagement>
>    <dependencies>
>        <dependency>
>            <groupId>com.acme</groupId>
>            <artifactId>coyote-tornado-kit</artifactId>
>            <version>[1.0.0]</version>
>        </dependency>
> </dependencyManagement>
>
> and in some project:
>
> <dependencies>
>    <dependency>
>        <groupId>com.acme</groupId>
>        <artifactId>coyote-tornado-kit</artifactId>
>        <version>[2.0.0]</version>
>    </dependency>
> </dependencies>
>
> then I would expect build to fail becouse hard versions are used.  
> Why is
> that not so?
>
> -Borut


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


Re: I would like build to fail

Posted by Nick Stolwijk <ni...@gmail.com>.
After talking with Brian on IRC we have found the issue and I have created a
Jira for it:

http://jira.codehaus.org/browse/MDEP-236

With regards,

Nick Stolwijk
~Java Developer~

IPROFS BV.
Claus Sluterweg 125
2012 WS Haarlem
http://www.iprofs.nl


On Tue, Oct 20, 2009 at 1:28 PM, Nick Stolwijk <ni...@gmail.com>wrote:

> Looking at the code [1] I see that exclusion errors are being regarded for
> buildfailures, but version mismatches aren't.  I think you can create a Jira
> issue requesting this feature.
>
> [1]
> http://svn.apache.org/viewvc/maven/plugins/tags/maven-dependency-plugin-2.1/src/main/java/org/apache/maven/plugin/dependency/AnalyzeDepMgt.java?view=markup
>
> Hth,
>
> Nick Stolwijk
> ~Java Developer~
>
> IPROFS BV.
> Claus Sluterweg 125
> 2012 WS Haarlem
> http://www.iprofs.nl
>
>
> On Tue, Oct 20, 2009 at 12:54 PM, Borut Bolčina <bo...@gmail.com>wrote:
>
>> Since
>>
>> 2009/10/20 Nick Stolwijk <ni...@gmail.com>
>>
>> > I also found two issues regarding the enforcer plugin:
>> >
>> > http://jira.codehaus.org/browse/MENFORCER-63
>> >
>>
>> was last Updated: 17/Feb/09 08:04 PM (long time ago)
>>
>> and
>>
>> > http://jira.codehaus.org/browse/MENFORCER-19
>> >
>>
>> was last Updated: 21/Oct/07 11:14 PM (2 years ago!)
>>
>> and there are hundred of enterprises out there using maven, I can only
>> conclude there MUST be a workaround or even a SOLUTION.
>>
>> -Borut
>>
>>
>> > Hth,
>> >
>> > Nick Stolwijk
>> > ~Java Developer~
>> >
>> > IPROFS BV.
>> > Claus Sluterweg 125
>> > 2012 WS Haarlem
>> > http://www.iprofs.nl
>> >
>> >
>> > On Tue, Oct 20, 2009 at 12:32 PM, Nick Stolwijk <
>> nick.stolwijk@gmail.com
>> > >wrote:
>> >
>> > > Which version of the dependency plugin are you using? The option
>> should
>> > > work for **2.0-alpha-3 and higher.
>> > >
>> > > Hth,
>> > >
>> > > Nick Stolwijk
>> > > ~Java Developer~
>> > >
>> > > IPROFS BV.
>> > > Claus Sluterweg 125
>> > > 2012 WS Haarlem
>> > > http://www.iprofs.nl
>> > >
>> > >
>> > > On Tue, Oct 20, 2009 at 12:25 PM, Borut Bolčina <
>> borut.bolcina@gmail.com
>> > >wrote:
>> > >
>> > >> analyze
>> > >
>> > >
>> > >
>> >
>>
>
>

Re: I would like build to fail

Posted by Nick Stolwijk <ni...@gmail.com>.
Looking at the code [1] I see that exclusion errors are being regarded for
buildfailures, but version mismatches aren't.  I think you can create a Jira
issue requesting this feature.

[1]
http://svn.apache.org/viewvc/maven/plugins/tags/maven-dependency-plugin-2.1/src/main/java/org/apache/maven/plugin/dependency/AnalyzeDepMgt.java?view=markup

Hth,

Nick Stolwijk
~Java Developer~

IPROFS BV.
Claus Sluterweg 125
2012 WS Haarlem
http://www.iprofs.nl


On Tue, Oct 20, 2009 at 12:54 PM, Borut Bolčina <bo...@gmail.com>wrote:

> Since
>
> 2009/10/20 Nick Stolwijk <ni...@gmail.com>
>
> > I also found two issues regarding the enforcer plugin:
> >
> > http://jira.codehaus.org/browse/MENFORCER-63
> >
>
> was last Updated: 17/Feb/09 08:04 PM (long time ago)
>
> and
>
> > http://jira.codehaus.org/browse/MENFORCER-19
> >
>
> was last Updated: 21/Oct/07 11:14 PM (2 years ago!)
>
> and there are hundred of enterprises out there using maven, I can only
> conclude there MUST be a workaround or even a SOLUTION.
>
> -Borut
>
>
> > Hth,
> >
> > Nick Stolwijk
> > ~Java Developer~
> >
> > IPROFS BV.
> > Claus Sluterweg 125
> > 2012 WS Haarlem
> > http://www.iprofs.nl
> >
> >
> > On Tue, Oct 20, 2009 at 12:32 PM, Nick Stolwijk <nick.stolwijk@gmail.com
> > >wrote:
> >
> > > Which version of the dependency plugin are you using? The option should
> > > work for **2.0-alpha-3 and higher.
> > >
> > > Hth,
> > >
> > > Nick Stolwijk
> > > ~Java Developer~
> > >
> > > IPROFS BV.
> > > Claus Sluterweg 125
> > > 2012 WS Haarlem
> > > http://www.iprofs.nl
> > >
> > >
> > > On Tue, Oct 20, 2009 at 12:25 PM, Borut Bolčina <
> borut.bolcina@gmail.com
> > >wrote:
> > >
> > >> analyze
> > >
> > >
> > >
> >
>

Re: I would like build to fail

Posted by Borut Bolčina <bo...@gmail.com>.
Since

2009/10/20 Nick Stolwijk <ni...@gmail.com>

> I also found two issues regarding the enforcer plugin:
>
> http://jira.codehaus.org/browse/MENFORCER-63
>

was last Updated: 17/Feb/09 08:04 PM (long time ago)

and

> http://jira.codehaus.org/browse/MENFORCER-19
>

was last Updated: 21/Oct/07 11:14 PM (2 years ago!)

and there are hundred of enterprises out there using maven, I can only
conclude there MUST be a workaround or even a SOLUTION.

-Borut


> Hth,
>
> Nick Stolwijk
> ~Java Developer~
>
> IPROFS BV.
> Claus Sluterweg 125
> 2012 WS Haarlem
> http://www.iprofs.nl
>
>
> On Tue, Oct 20, 2009 at 12:32 PM, Nick Stolwijk <nick.stolwijk@gmail.com
> >wrote:
>
> > Which version of the dependency plugin are you using? The option should
> > work for **2.0-alpha-3 and higher.
> >
> > Hth,
> >
> > Nick Stolwijk
> > ~Java Developer~
> >
> > IPROFS BV.
> > Claus Sluterweg 125
> > 2012 WS Haarlem
> > http://www.iprofs.nl
> >
> >
> > On Tue, Oct 20, 2009 at 12:25 PM, Borut Bolčina <borut.bolcina@gmail.com
> >wrote:
> >
> >> analyze
> >
> >
> >
>

Re: I would like build to fail

Posted by Nick Stolwijk <ni...@gmail.com>.
I also found two issues regarding the enforcer plugin:

http://jira.codehaus.org/browse/MENFORCER-63
http://jira.codehaus.org/browse/MENFORCER-19

Hth,

Nick Stolwijk
~Java Developer~

IPROFS BV.
Claus Sluterweg 125
2012 WS Haarlem
http://www.iprofs.nl


On Tue, Oct 20, 2009 at 12:32 PM, Nick Stolwijk <ni...@gmail.com>wrote:

> Which version of the dependency plugin are you using? The option should
> work for **2.0-alpha-3 and higher.
>
> Hth,
>
> Nick Stolwijk
> ~Java Developer~
>
> IPROFS BV.
> Claus Sluterweg 125
> 2012 WS Haarlem
> http://www.iprofs.nl
>
>
> On Tue, Oct 20, 2009 at 12:25 PM, Borut Bolčina <bo...@gmail.com>wrote:
>
>> analyze
>
>
>

Re: I would like build to fail

Posted by Borut Bolčina <bo...@gmail.com>.
Running with -X

[DEBUG] Configuring mojo
'org.apache.maven.plugins:maven-dependency-plugin:2.0:analyze-dep-mgt' -->
[DEBUG]   (s) failBuild = true
[DEBUG]   (s) ignoreDirect = false


2009/10/20 Nick Stolwijk <ni...@gmail.com>

> Which version of the dependency plugin are you using? The option should
> work
> for **2.0-alpha-3 and higher.
>
> Hth,
>
> Nick Stolwijk
> ~Java Developer~
>
> IPROFS BV.
> Claus Sluterweg 125
> 2012 WS Haarlem
> http://www.iprofs.nl
>
>
> On Tue, Oct 20, 2009 at 12:25 PM, Borut Bolčina <borut.bolcina@gmail.com
> >wrote:
>
> > analyze
>

Re: I would like build to fail

Posted by Nick Stolwijk <ni...@gmail.com>.
Which version of the dependency plugin are you using? The option should work
for **2.0-alpha-3 and higher.

Hth,

Nick Stolwijk
~Java Developer~

IPROFS BV.
Claus Sluterweg 125
2012 WS Haarlem
http://www.iprofs.nl


On Tue, Oct 20, 2009 at 12:25 PM, Borut Bolčina <bo...@gmail.com>wrote:

> analyze

Re: I would like build to fail

Posted by Borut Bolčina <bo...@gmail.com>.
Hello Nick

I have added

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <executions>
        <execution>
            <id>analyze</id>
            <phase>verify</phase>
            <goals>
                <goal>analyze-dep-mgt</goal>
            </goals>
            <configuration>
                <failBuild>true</failBuild>
                <ignoreDirect>false</ignoreDirect>
            </configuration>
        </execution>
    </executions>
</plugin>

in the child project which is using the company pom.

The build still succeds:

[INFO] [dependency:analyze-dep-mgt {execution: analyze}]
[INFO] Found Resolved Dependency / DependencyManagement mismatches:
[INFO]  Dependency: org.json:json:jar
[INFO]          DepMgt  : [1.0.2]
[INFO]          Resolved: 1.0.2
[INFO]  Dependency: commons-lang:commons-lang:jar
[INFO]          DepMgt  : [2.4]
[INFO]          Resolved: 2.4
[INFO]  Dependency: log4j:log4j:jar
[INFO]          DepMgt  : [1.2.14]
[INFO]          Resolved: 1.2.14
[INFO]  Dependency: opensymphony:quartz-all:jar
[INFO]          DepMgt  : [1.6.5]
[INFO]          Resolved: 1.6.5
[INFO]  Dependency: org.apache.cayenne:cayenne-server:jar
[INFO]          DepMgt  : [3.0M6]
[INFO]          Resolved: 3.0M5
[INFO]  Dependency: mysql:mysql-connector-java:jar
[INFO]          DepMgt  : [5.0.6]
[INFO]          Resolved: 5.0.6
[INFO]    None
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO]
------------------------------------------------------------------------

Focus on the org.apache.cayenne:cayenne-server:jar.

In my child project there is:

<dependency>
    <groupId>org.apache.cayenne</groupId>
    <artifactId>cayenne-server</artifactId>
    <version>[3.0M5]</version>
</dependency>

and in company pom:

<dependencyManagement>
        <dependency>
            <groupId>org.apache.cayenne</groupId>
            <artifactId>cayenne-server</artifactId>
            <version>[3.0M6]</version>
        </dependency>
    </dependencies>
</dependencyManagement>

I am using Maven 2.2.0:
Apache Maven 2.2.0 (r788681; 2009-06-26 15:04:01+0200)
Java version: 1.6.0_16
Java home: C:\Java\jdk1.6.0_16\jre
Default locale: sl_SI, platform encoding: Cp1250
OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"

What am I missing? I want build to fail if some developer is trying to build
an artifact which has version conflict.

-Borut


2009/10/20 Nick Stolwijk <ni...@gmail.com>

> That is because you didn't enforce maven to fail the build. Take a look at
> the dependencies plugin [1]
>
> [1]
>
> http://maven.apache.org/plugins/maven-dependency-plugin/analyze-dep-mgt-mojo.html#failBuild
>
> Hth,
>
> Nick Stolwijk
> ~Java Developer~
>
> IPROFS BV.
> Claus Sluterweg 125
> 2012 WS Haarlem
> http://www.iprofs.nl
>
>
> On Tue, Oct 20, 2009 at 11:39 AM, Borut Bolčina <borut.bolcina@gmail.com
> >wrote:
>
> > Hi,
> >
> > if in parent pom (company POM for example):
> >
> > <dependencyManagement>
> >    <dependencies>
> >        <dependency>
> >            <groupId>com.acme</groupId>
> >            <artifactId>coyote-tornado-kit</artifactId>
> >            <version>[1.0.0]</version>
> >        </dependency>
> > </dependencyManagement>
> >
> > and in some project:
> >
> > <dependencies>
> >    <dependency>
> >        <groupId>com.acme</groupId>
> >        <artifactId>coyote-tornado-kit</artifactId>
> >        <version>[2.0.0]</version>
> >    </dependency>
> > </dependencies>
> >
> > then I would expect build to fail becouse hard versions are used. Why is
> > that not so?
> >
> > -Borut
> >
>

Re: I would like build to fail

Posted by Nick Stolwijk <ni...@gmail.com>.
That is because you didn't enforce maven to fail the build. Take a look at
the dependencies plugin [1]

[1]
http://maven.apache.org/plugins/maven-dependency-plugin/analyze-dep-mgt-mojo.html#failBuild

Hth,

Nick Stolwijk
~Java Developer~

IPROFS BV.
Claus Sluterweg 125
2012 WS Haarlem
http://www.iprofs.nl


On Tue, Oct 20, 2009 at 11:39 AM, Borut Bolčina <bo...@gmail.com>wrote:

> Hi,
>
> if in parent pom (company POM for example):
>
> <dependencyManagement>
>    <dependencies>
>        <dependency>
>            <groupId>com.acme</groupId>
>            <artifactId>coyote-tornado-kit</artifactId>
>            <version>[1.0.0]</version>
>        </dependency>
> </dependencyManagement>
>
> and in some project:
>
> <dependencies>
>    <dependency>
>        <groupId>com.acme</groupId>
>        <artifactId>coyote-tornado-kit</artifactId>
>        <version>[2.0.0]</version>
>    </dependency>
> </dependencies>
>
> then I would expect build to fail becouse hard versions are used. Why is
> that not so?
>
> -Borut
>