I would suggest that the help documentation is wrong. To my knowledge, Maven always tries to update the snapshots at every invocation - precisely the concept of the snapshot. For full releases, however, Maven won't try to re-download releases if they are already in the local repo, or if it has already tried to find (and failed) a release within a predetermined elapsed time.
I've always understood the -U parameter to force maven to check for different versions than what already exists in the local repo, and to force Maven to recheck for the existance of a dependency, even it has already tried and failed. Thanks, Eric On Tue, May 17, 2016 at 11:04 AM, Adam Mitchell <[email protected]> wrote: > Whilst that's true of the maven documentation, when you start digging into > how it's used during artifact resolution it acts as an override for a > repository's update policy. > > (from 3.3.9 release) > > It ends up set on > org.apache.maven.artifact.repository.RepositoryRequest#isForceUpdate() > > /** > * Indicates whether remote repositories should be re-checked for > updated artifacts/metadata regardless of their > * configured update policy. > * > * @return {@code true} if remote repositories should be re-checked > for updated artifacts/metadata, {@code false} > * otherwise. > */ > boolean isForceUpdate(); > > /** > * Enables/disabled forced checks for updated artifacts/metadata on > remote repositories. > * > * @param forceUpdate {@code true} to forcibly check the remote > repositories for updated artifacts/metadata, {@code > * false} to use the update policy configured on each > repository. > * @return This request, never {@code null}. > */ > RepositoryRequest setForceUpdate( boolean forceUpdate ); > > Or in the case where you end up in aether, it sets your repository session > to always update: > org.apache.maven.internal.aether.DefaultRepositorySystemSessionFactory:114 > else if ( request.isUpdateSnapshots() ) > { > session.setUpdatePolicy( RepositoryPolicy.UPDATE_POLICY_ALWAYS > ); > } > > The net result is the same. > > Though I admit that I wouldn't expect this to necessarily re-download > source code unless the metadata was corrupt/missing, it certainly has more > meaning that just update snapshots. > > Quite possibly a bug in maven-core then. > > > > > | Adam Mitchell | Java Software Architect | Tel: +44 (0)207 633 3570 | > Mobile: | Skype: | www.playtech.com > > This communication contains information which is privileged and > confidential and is exclusively intended only for the individual or entity > named above (recipient(s)). If you are not the intended recipient(s) or the > person responsible for delivering it to the intended recipient(s), you are > hereby notified that any review, disclosure, dissemination, distribution or > reproduction of this communication message in any way or act is prohibited. > If you receive this communication by mistake please notify the sender > immediately and then destroy any copies of it. Please note that the sender > monitors e-mails sent or received. Thank you. > -----Original Message----- > From: Thomas Broyer [mailto:[email protected]] > Sent: 17 May 2016 11:03 > To: Maven Users List <[email protected]> > Subject: Re: mvn -U dependency:sources re-downloads released sources JARs > > On Tue, May 17, 2016 at 11:29 AM Adam Mitchell <[email protected] > > > wrote: > > > -U is force update, it tells maven to ignore locally cached artifacts > > and to download them afresh, what behaviour were you expecting? > > > > -U stands for "update-snapshots" and aims at downloading only "missing > releases" (and "updated snapshots", of course). > > $ mvn -h > > usage: mvn [options] [<goal(s)>] [<phase(s)>] > > Options: > […] > -U,--update-snapshots Forces a check for missing > releases and updated snapshots on > remote repositories $ mvn -v > Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; > 2015-11-10T17:41:47+01:00) > Maven home: /mnt/ssd/tbr/tools/maven > Java version: 1.8.0_91, vendor: Oracle Corporation Java home: > /usr/lib/jvm/java-8-oracle/jre Default locale: fr_FR, platform encoding: > UTF-8 OS name: "linux", version: "4.4.0-22-generic", arch: "amd64", family: > "unix" > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] >
