Hi Karl, 

Thanks for the quick answer.

Our build farm uses maven 3.0.4, but the issue is reproducible with maven 3.3.9

The projects are three independent projects, no multi-module build. There are 
three teams, each responsible for one project, with independent release cycles.

'parent' -> infrastructure team
'lib' -> common utilities used by many apps
'app' -> a dedicated application

To reproduce the issue, git clone all three mini projects from 
https://github.com/iroif
git clone https://github.com/iroif/iroif-parent.git 
git clone https://github.com/iroif/iroif-lib.git 
git clone https://github.com/iroif/iroif-app.git 

the remote repo used in these samples is a basic local installation of nexus 
(2.11.4-01) at http://localhost:1082/nexus
(see https://github.com/iroif/iroif-parent/blob/master/settings.xml  and 
https://github.com/iroif/iroif-parent/blob/master/pom.xml )

day 0

pushd iroif-parent
git checkout 86fd6835
mvn clean deploy -s settings.xml -Dmaven.repo.local=/c/tmp/iroif-parent
popd 
pushd iroif-lib
git checkout 99d25e0a
mvn clean deploy -s ../iroif-parent/settings.xml 
-Dmaven.repo.local=/c/tmp/iroif-lib
popd
pushd iroif-app
git checkout bda76f8a
mvn clean install -s ../iroif-parent/settings.xml 
-Dmaven.repo.local=/c/tmp/iroif-app
-> [INFO] BUILD SUCCESS
popd

day 1
pushd iroif-parent
git checkout cb15c025
mvn clean deploy -s settings.xml -Dmaven.repo.local=/c/tmp/iroif-parent
popd
(all other builds OK)

day 2
pushd iroif-lib
git checkout 3fde3a44
mvn clean deploy -s ../iroif-parent/settings.xml 
-Dmaven.repo.local=/c/tmp/iroif-lib
popd

at this day, iroif-app dependency to iroif-lib [0.0.1-SNAPSHOT,) version range 
is resolved to 0.0.2-SNAPSHOT :
pushd iroif-parent
mvn dependency:tree -s ../iroif-parent/settings.xml  
-Dmaven.repo.local=/c/tmp/iroif-app
returns
[INFO] net.aequologica.iroif:iroif-app:jar:0.1.0-SNAPSHOT
[INFO] \- net.aequologica.iroif:iroif-lib:jar:0.0.2-SNAPSHOT:compile

day 3

iroif-parent 0.0.1-SNAPSHOT is deleted from Snapshots repo in nexus, + 'Expire 
Cache' + 'Rebuild Metadata' + 'Update Index'

then (starting with a brand new local repo, iroif-app-2)

pushd iroif-app
git checkout bda76f8a
mvn clean install -s ../iroif-parent/settings.xml 
-Dmaven.repo.local=/c/tmp/iroif-app-2

BUILD FAILURE

[ERROR] Failed to execute goal on project iroif-app: Could not resolve 
dependencies for project net.aequologica.iroif:iroif-app:jar:0.1.0-SNAPSHOT: 
Failed to collect dependencies at 
net.aequologica.iroif:iroif-lib:jar:0.0.1-SNAPSHOT: Failed to read artifact 
descriptor for net.aequologica.iroif:iroif-lib:jar:0.0.1-SNAPSHOT: Could not 
find artifact net.aequologica.iroif:iroif-parent:pom:0.0.1-SNAPSHOT in 
local_nexus (http://localhost:1082/nexus/content/groups/public/)

mvn dependency:tree fails as well, of course

day 4

iroif-lib 0.0.1-SNAPSHOT is deleted from Snapshots repo in nexus, + 'Expire 
Cache' + 'Rebuild Metadata' + 'Update Index'

then (starting with a brand new local repo, iroif-app-3)

pushd iroif-app
git checkout bda76f8a
mvn clean install -s ../iroif-parent/settings.xml 
-Dmaven.repo.local=/c/tmp/iroif-app-3

BUILD SUCCESS

Sorry for the load of details, hope that helps.

Thanks
Christophe

-----Original Message-----
From: Karl Heinz Marbaise [mailto:[email protected]] 
Sent: Mittwoch, 3. August 2016 20:17
To: Maven Users List <[email protected]>
Subject: Re: project having a dependency with a version range fails building 
when parent pom of dependency is evicted from remote repo

Hi,

how are you calling Maven? And which version of Maven do you use?

Furthermore I've got the impressions that those modules belong together ?

Kind regards
Karl Heinz

On 8/3/16 8:10 PM, Thiebaud, Christophe wrote:
> Hi All,
>
>
>
> The title says it all.
>
>
>
> Any suggestions how to overcome this issue ?
>
>
>
> Explanation below. Let the projects be:
>
>
>
> ‘parent’ : the parent pom of the ‘lib’ library just below
>
> ‘lib’ : the library
>
> ‘app’ : the application dependent on ‘lib’ through a version range.
>
>
>
> (all three minimalistic sample projects here: https://github.com/iroif)
>
>
>
> [cid:[email protected]]
>
>
>
> Here is what happens during time, when versions are bumped and projects are 
> deployed to remote repo:
>
>
>
> day 0
>
>
>
> ‘parent’ 0.0.1-SNAPSHOT is deployed to remote repo
>
> ‘lib’    0.0.1-SNAPSHOT is deployed to remote repo
>
> ‘app’ builds OK
>
>
>
> day 1
>
>
>
> ‘parent’ 0.0.1-SNAPSHOT is still on remote repo
>
> ‘parent’ 0.0.2-SNAPSHOT is deployed to remote repo
>
> ‘lib’    0.0.1-SNAPSHOT is still on remote repo
>
> ‘app’ builds OK
>
>
>
> day 2
>
>
>
> ‘parent’ 0.0.1-SNAPSHOT is still on remote repo
>
> ‘parent’ 0.0.2-SNAPSHOT is still on remote repo
>
> ‘lib’    0.0.1-SNAPSHOT is still on remote repo
>
> ‘lib’    0.0.2-SNAPSHOT is deployed to remote repo
>
> ‘app’ builds OK
>
>
>
> day 3
>
>
>
> ‘parent’ 0.0.1-SNAPSHOT is automatically evicted from remote repo by some rule
>
> ‘parent’ 0.0.2-SNAPSHOT is still on remote repo
>
> ‘lib’    0.0.1-SNAPSHOT is still on remote repo
>
> ‘lib’    0.0.2-SNAPSHOT is still on remote repo
>
> ‘app’ build FAILS
>
>
>
> this is because maven tries to build the pom for ‘lib’ 0.0.1-SNAPSHOT and 
> fails as ‘parent’ 0.0.1-SNAPSHOT is not available anymore.
>
>
>
> However, IMHO, the build of ‘app’ should not fail as there is another valid 
> dependency resolution : ‘lib’ 0.0.2-SNAPSHOT with ‘parent’ 0.0.2-SNAPSHOT.
>
>
>
> In fact, when the relationship between parent and lib is a dependency (and 
> not a parent-child relationship), the build of ‘app’ succeeds, even when 
> transitive dependency to ‘parent’ 0.0.1-SNAPSHOT cannot be resolved.
>
>
>
> Note that ‘app’ build is successful again, when on day 4, ‘lib’ 
> 0.0.1-SNAPSHOT is in turn evicted:
>
>
>
> day 4
>
>
>
> ‘parent’ 0.0.2-SNAPSHOT is still on remote repo
>
> ‘lib’    0.0.1-SNAPSHOT is automatically evicted from remote repo by some rule
>
> ‘lib’    0.0.2-SNAPSHOT is still on remote repo
>
> ‘app’ build resumes OK
>
>
>
> Any suggestions how to overcome this issue ?
>
>
>
> We have builds failing every other day in our build farm for this reason.
>
>
>
> Thanks!
>
> Christophe
>
> PS. The content of this mail is duplicated here : 
> https://github.com/iroif/iroif-parent
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to