Skip to content

Commit cd8c17e

Browse files
committed
[MRESOLVER-633] Document caching of unresolvable artifacts
1 parent b862729 commit cd8c17e

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/site/markdown/local-repository.md

+18
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ specific language governing permissions and limitations
1818
under the License.
1919
-->
2020

21+
<!--MACRO{toc|fromDepth=1}-->
22+
2123
Maven Resolver implements a "local repository" (that is used by Maven itself
2224
as well), that since the beginning of time was a "mixed bag of beans",
2325
it served twofold purposes: to cache the artifacts downloaded from
@@ -188,3 +190,19 @@ available, providing out of the box lock implementations for cases like:
188190

189191
For details see [Named Locks module](maven-resolver-named-locks/).
190192

193+
## Error Handling and Caching
194+
195+
By default each artifact which cannot be resolved leads to an error either classified as
196+
197+
1. *not found* error or
198+
2. (any) *other* error (for authentication issues, timeouts etc.)
199+
200+
The caching behavior for both types can be be configured programmatically via `org.eclipse.aether.DefaultRepositorySystemSession.setResolutionErrorPolicy(...)`.
201+
202+
In case caching is enabled for any of the two classifications a Java Properties file is created/updated (with the same filename as the cached artifact in the success case would get but with the additional suffix `.lastUpdated`) in the local repository. Within that file the key `<canonical-remote-url>.error` is updated/added. Its value either contains the error message (for type 2 resolver errors) or is empty (for type 1 resolver errors).
203+
204+
### Configuration in Maven
205+
206+
In Maven 3 resolver errors of **type 1** are **always cached** and the ones of **type 2** are **never cached**.
207+
208+
With [Maven 4](https://issues.apache.org/jira/browse/MNG-7653) the caching of type 1 errors can be disabled with CLI option `-canf false` (still enabled by default). However, the caching of type 2 errors is disabled without any way to override that policy even in Maven 4.

0 commit comments

Comments
 (0)