Thank you Vincent.  This is what I thought, but just wanted to confirm. IMHO, 
having your local dependencies change out from under you is counter-intuitive 
especially when you're building that component locally. So setting the snapshot 
dependency to "never" seems like it would produce a more intuitive behavior. 
But as you point out, if at some point in the future I decided to remove the 
local source for componentA (and therefore stop building it), I'd have to know 
to either blow away my local repo or use -U. What I'd really like is a behavior 
that says: "If I'm not building a dependent component locally, always download 
snapshots.  Otherwise, never download snapshots.  But I understand that this 
would be difficult to achieve.

-b

________________________________________
From: ext Vincent Latombe [[email protected]]
Sent: Saturday, October 16, 2010 6:59 PM
To: Maven Users List
Subject: Re: Questions on SNAPSHOTs

Hello Brian

What you assume is right : if the timestamp of a remote artifact is more
recent than the timestamp of a local artifact (under .m2), it will download
the version from the remote repository. This will be happening depending on
the updatePolicy (daily by default), or if you add -U flag to the command
line.

If you want to be sure that your local changes are picked up every time and
not overriden by a remote snapshot, you have 2 options :
- recompile your local changes to component A at least once a day (with
default value of updatePolicy which is daily)
- set updatePolicy to "never". In this case, Maven will download remote
snapshots artifacts only if you don't already have them locally.

The drawback of the second option is that you'll need to use -U each time
you want new remote snapshots, but at least you won't be surprised.

Hope it answer your interrogations,

Cheers,

Vincent

2010/10/16 <[email protected]>

> My apologies for my previous post.  That's what I get for trying to save a
> step by replying to someone else's post, but forgetting to change the
> subject :-[
>
> Hi all,
>
> I could use some clarification on how SNAPSHOTs work.
>
> Scenario:
>
> - Maven 2.2.1
> - componentB depends on componentA, both are being built as snapshot
> versions.
> - I have the source code for both components locally and have built and
> installed both to my local repo (mvn install)
> - Both components are also built on a CI server and the snapshot artifacts
> are deployed to our in-house Artifactory repo.
>  Builds occur automatically whenever a change is detected by our CI server.
>
> Questions:
>
> Let's say I'm working on componentB. When building componentB, in what
> cases will componentA be downloaded from Artifactory?
> That is, what controls whether I am building componentB against the version
> of componentA that I built and installed in my local repo
> or against a newly-downloaded version that had been deployed to
> Artifactory?
>
> How is all of this affected by the snapshots updatePolicy in my settings?
> By default, does a new version of componentA get downloaded
> every day (assuming a new one has been deployed to Artifactory)?
>
> Thanks.
>
> -brian
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>


--
Vincent

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

Reply via email to