You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Shipp, Scott" <ss...@ebay.com.INVALID> on 2022/03/25 16:03:03 UTC

Can anyone confirm the behavior of updatePolicy never for repositories?

Hi fellow Maven users,

I have used Maven for 10 years or more and I’m writing with a first. I have a project which was set up in Jenkins with a settings.xml that has updatePolicy set to “never” for a certain repository.

I have experienced that when Maven 3.3.9 fails to resolve an artifact for any reason (could be connection error, the artifact is not there at the time, or any other reason) the first build notes that it will “cache the failure” as follows:


Failure to find org.example:foo:jar:0.0.1-RELEASE in https://example.org/foo/repository/ was cached in the local repository, resolution will not be reattempted until the update interval of foo.repository has elapsed or updates are forced



Subsequent builds then always fail with log output similar to the below, regardless of whether the connection can be re-established or the dependency is now available:


14:01:07 [ERROR] Failed to execute goal on project foo: Could not resolve dependencies for project org.example:foo:jar:0.0.1-RELEASE: Failed to collect dependencies for org.example:foo:jar:0.0.1-RELEASE: Failed to read artifact descriptor for org.example:foo:jar:0.0.1-RELEASE: Could not find artifact org.example:foo:jar:0.0.1-RELEASE in foo.repository (https://example.org/foo/repository/) ….


Unfortunately, I believe the -U flag cannot be used here as it applies to SNAPSHOT dependencies only. An experiment of passing -U further bore this out and did not resolve the issue.

My questions here are:


  1.  Is this the expected behavior for “never” value of updatePolicy?
  2.  If so, what purpose is this “never” setting meant to serve? What is a valid use case?
  3.  Is there any way to force the update for a RELEASE artifact when updatePolicy is “never”?

Scott



Re: Can anyone confirm the behavior of updatePolicy never for repositories?

Posted by Alexander Kriegisch <al...@kriegisch.name>.
That was great advice, Bernd. I never was aware of that goal before,
mostly using the 'analzye' and 'tree' goals. I also see that it is
possible not use includes and excludes, i.e. to just purge what annoys
you and not a whole 60 GB or so local repo. For reference:

https://maven.apache.org/plugins/maven-dependency-plugin/examples/purging-local-repository.html

-- 
Alexander Kriegisch
https://scrum-master.de

> -U works on release artifacts as well. Alternatively you can delete
> the version (either manually in the filesystem or with a maven
> dependency:purge-local-repository).

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


Re: Can anyone confirm the behavior of updatePolicy never for repositories?

Posted by Bernd Eckenfels <ec...@zusammenkunft.net>.
-U works on release artifacts as well. Alternatively you can delete the version (either manually in the filesystem or with a maven dependency:purge-local-repository).

I think the Never-policy was not meant to deal with errors, it is more about immutability of the actual releases.

Gruss
Bernd
--
http://bernd.eckenfels.net
________________________________
Von: Shipp, Scott <ss...@ebay.com.INVALID>
Gesendet: Friday, March 25, 2022 5:03:03 PM
An: users@maven.apache.org <us...@maven.apache.org>
Betreff: Can anyone confirm the behavior of updatePolicy never for repositories?

Hi fellow Maven users,

I have used Maven for 10 years or more and I’m writing with a first. I have a project which was set up in Jenkins with a settings.xml that has updatePolicy set to “never” for a certain repository.

I have experienced that when Maven 3.3.9 fails to resolve an artifact for any reason (could be connection error, the artifact is not there at the time, or any other reason) the first build notes that it will “cache the failure” as follows:


Failure to find org.example:foo:jar:0.0.1-RELEASE in https://example.org/foo/repository/ was cached in the local repository, resolution will not be reattempted until the update interval of foo.repository has elapsed or updates are forced



Subsequent builds then always fail with log output similar to the below, regardless of whether the connection can be re-established or the dependency is now available:


14:01:07 [ERROR] Failed to execute goal on project foo: Could not resolve dependencies for project org.example:foo:jar:0.0.1-RELEASE: Failed to collect dependencies for org.example:foo:jar:0.0.1-RELEASE: Failed to read artifact descriptor for org.example:foo:jar:0.0.1-RELEASE: Could not find artifact org.example:foo:jar:0.0.1-RELEASE in foo.repository (https://example.org/foo/repository/) ….


Unfortunately, I believe the -U flag cannot be used here as it applies to SNAPSHOT dependencies only. An experiment of passing -U further bore this out and did not resolve the issue.

My questions here are:


  1.  Is this the expected behavior for “never” value of updatePolicy?
  2.  If so, what purpose is this “never” setting meant to serve? What is a valid use case?
  3.  Is there any way to force the update for a RELEASE artifact when updatePolicy is “never”?

Scott