You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Eric Swenson <es...@intertrust.com> on 2009/02/18 19:39:24 UTC

Dependency/Version Issue with maven

We're running into an issue that causes our automated builds to fail
quite frequently now and wonder what it is about our use of maven that
is causing this.  The builds are failing because the order in which
maven (2.0.9) is choosing to build the components of a large,
multi-component project is "wrong".  The question we are trying to
answer is "how to get maven to build in the right order".  

 

Here is the failing scenario.  Say there are two modules, Module1 and
Module2 where Module1 depends on Module2.  A developer makes an
incompatible change to Module2 and makes a corresponding change to
Module1 so that it becomes compatible with the updated Module2.  The
version number in neither pom is updated since we are using snapshots,
and this change is but one of many in a lifecycle of changes for these
versions of the two components.  

 

If the build machine completely wipes the local maven repository, pulls
afresh from source controls, and does a "mvn clean install", of course,
everything works just fine.  However, our build machine doesn't wipe the
local repository, does an "svn update", and a "mvn install".  In this
case, maven must do something along the lines of:

 

*         Realizes that Module1 needs to be rebuilt because of changes
of source files for that module

*         Realizes that Module2 needs to be rebuilt because of changes
of sources files for that module

*         Looks at the dependency lists of all modules and decides to
build Module1 first, followed by Module2.  It noted that Module1 was
dependent on Module2, but it looked at the version number of the
dependency and noted that the local maven repository already has an
(old) version of the Module2 artifact - same version number, but an old
(incompatible) snapshot).  So it concluded, since there was already the
correct version in the maven local repo, that it didn't need to build
Module2 first.

*         It compiles Module1, which fails because Module2 is required
to be rebuilt first (and the local maven repo updated with the changes).

 

What are we doing wrong in our use of maven here that makes this not
work?  We don't want to have to clean out the local repo before each
build.  Changing the build to use "mvn clean install" doesn't help.  The
exact same problem occurs for the exact same reason.  

 

Note, although we are using snapshot versions for all our components, we
are NOT deploying to a shared repository (or even the build machine's
local repository).  

 

Any help or suggestions on changes to our use of maven?

 

n  Eric


Re: Dependency/Version Issue with maven

Posted by Eric Swenson <er...@swenson.org>.
We found the problem today. It turns out that the command we were using to
build was:
     mvn install site

(we also tried:

     mvn clean install site)

It turns out that it is the "site" that is causing the problem.  There is a
JIRA ticket on this issue (I'm not on my work machine right now and can't
get at the reference I found) -- where the javadoc plugin invoked by the
"site" is messed up the transitive dependencies.

I removed the "site" from the mvn command line, and the dependency graph
apparently began getting constructed properly and the build didn't fail any
more in the same kinds of situations where it previous had failed.

Thanks very much for your response, though. And thanks for letting me know
that the local repo is not factored in in dependency calculation. That makes
more sense.  And yes, we are using versions to describe the dependencies
between modules.

-- Eric

On Wed, Feb 18, 2009 at 6:56 PM, Brian E. Fox <br...@reply.infinity.nu>wrote:

> When building the directed graph of how to order the modules at build
> time, Maven doesn't consider (that I'm aware of) the existence of a
> dependency in the local repo. Are you using versions to describe the
> dependency between these modules? That's about the only thing that comes
> to mind? (even though they are the same version, it may influence it
> somehow)
>
> You can try reordering the modules in your pom, this would possibly
> cause this problem to go away, but tf you can make a sample project for
> this, I'd be interested in taking a look.
>
> --Brian
>
> -----Original Message-----
> From: Eric Swenson [mailto:eswenson@intertrust.com]
> Sent: Wednesday, February 18, 2009 1:39 PM
> To: users@maven.apache.org
> Cc: eric@swenson.org; Eric Swenson
> Subject: Dependency/Version Issue with maven
>
> We're running into an issue that causes our automated builds to fail
> quite frequently now and wonder what it is about our use of maven that
> is causing this.  The builds are failing because the order in which
> maven (2.0.9) is choosing to build the components of a large,
> multi-component project is "wrong".  The question we are trying to
> answer is "how to get maven to build in the right order".
>
>
>
> Here is the failing scenario.  Say there are two modules, Module1 and
> Module2 where Module1 depends on Module2.  A developer makes an
> incompatible change to Module2 and makes a corresponding change to
> Module1 so that it becomes compatible with the updated Module2.  The
> version number in neither pom is updated since we are using snapshots,
> and this change is but one of many in a lifecycle of changes for these
> versions of the two components.
>
>
>
> If the build machine completely wipes the local maven repository, pulls
> afresh from source controls, and does a "mvn clean install", of course,
> everything works just fine.  However, our build machine doesn't wipe the
> local repository, does an "svn update", and a "mvn install".  In this
> case, maven must do something along the lines of:
>
>
>
> *         Realizes that Module1 needs to be rebuilt because of changes
> of source files for that module
>
> *         Realizes that Module2 needs to be rebuilt because of changes
> of sources files for that module
>
> *         Looks at the dependency lists of all modules and decides to
> build Module1 first, followed by Module2.  It noted that Module1 was
> dependent on Module2, but it looked at the version number of the
> dependency and noted that the local maven repository already has an
> (old) version of the Module2 artifact - same version number, but an old
> (incompatible) snapshot).  So it concluded, since there was already the
> correct version in the maven local repo, that it didn't need to build
> Module2 first.
>
> *         It compiles Module1, which fails because Module2 is required
> to be rebuilt first (and the local maven repo updated with the changes).
>
>
>
> What are we doing wrong in our use of maven here that makes this not
> work?  We don't want to have to clean out the local repo before each
> build.  Changing the build to use "mvn clean install" doesn't help.  The
> exact same problem occurs for the exact same reason.
>
>
>
> Note, although we are using snapshot versions for all our components, we
> are NOT deploying to a shared repository (or even the build machine's
> local repository).
>
>
>
> Any help or suggestions on changes to our use of maven?
>
>
>
> n  Eric
>
>

RE: Dependency/Version Issue with maven

Posted by "Brian E. Fox" <br...@reply.infinity.nu>.
When building the directed graph of how to order the modules at build
time, Maven doesn't consider (that I'm aware of) the existence of a
dependency in the local repo. Are you using versions to describe the
dependency between these modules? That's about the only thing that comes
to mind? (even though they are the same version, it may influence it
somehow)

You can try reordering the modules in your pom, this would possibly
cause this problem to go away, but tf you can make a sample project for
this, I'd be interested in taking a look.

--Brian

-----Original Message-----
From: Eric Swenson [mailto:eswenson@intertrust.com] 
Sent: Wednesday, February 18, 2009 1:39 PM
To: users@maven.apache.org
Cc: eric@swenson.org; Eric Swenson
Subject: Dependency/Version Issue with maven

We're running into an issue that causes our automated builds to fail
quite frequently now and wonder what it is about our use of maven that
is causing this.  The builds are failing because the order in which
maven (2.0.9) is choosing to build the components of a large,
multi-component project is "wrong".  The question we are trying to
answer is "how to get maven to build in the right order".  

 

Here is the failing scenario.  Say there are two modules, Module1 and
Module2 where Module1 depends on Module2.  A developer makes an
incompatible change to Module2 and makes a corresponding change to
Module1 so that it becomes compatible with the updated Module2.  The
version number in neither pom is updated since we are using snapshots,
and this change is but one of many in a lifecycle of changes for these
versions of the two components.  

 

If the build machine completely wipes the local maven repository, pulls
afresh from source controls, and does a "mvn clean install", of course,
everything works just fine.  However, our build machine doesn't wipe the
local repository, does an "svn update", and a "mvn install".  In this
case, maven must do something along the lines of:

 

*         Realizes that Module1 needs to be rebuilt because of changes
of source files for that module

*         Realizes that Module2 needs to be rebuilt because of changes
of sources files for that module

*         Looks at the dependency lists of all modules and decides to
build Module1 first, followed by Module2.  It noted that Module1 was
dependent on Module2, but it looked at the version number of the
dependency and noted that the local maven repository already has an
(old) version of the Module2 artifact - same version number, but an old
(incompatible) snapshot).  So it concluded, since there was already the
correct version in the maven local repo, that it didn't need to build
Module2 first.

*         It compiles Module1, which fails because Module2 is required
to be rebuilt first (and the local maven repo updated with the changes).

 

What are we doing wrong in our use of maven here that makes this not
work?  We don't want to have to clean out the local repo before each
build.  Changing the build to use "mvn clean install" doesn't help.  The
exact same problem occurs for the exact same reason.  

 

Note, although we are using snapshot versions for all our components, we
are NOT deploying to a shared repository (or even the build machine's
local repository).  

 

Any help or suggestions on changes to our use of maven?

 

n  Eric


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