You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Christoph Läubrich (Jira)" <ji...@apache.org> on 2022/09/10 09:17:00 UTC

[jira] [Created] (MNG-7538) Delay the download of a file until it is first accesed

Christoph Läubrich created MNG-7538:
---------------------------------------

             Summary: Delay the download of a file until it is first accesed
                 Key: MNG-7538
                 URL: https://issues.apache.org/jira/browse/MNG-7538
             Project: Maven
          Issue Type: Improvement
            Reporter: Christoph Läubrich


Currently there is {code:java}org.apache.maven.artifact.Artifact.setFile(File){code} that is used while resolving an Artifact against a remote repository and that points to an exiting file in the local repository.

This approach has the drawback, that during resolving an Artifact it needs to be fully downloaded, even though it might not be used (yet) if one likes to find out if it is resolvable and the meta-data would be enough to e.g. resolve it and its dependencies.

I therefore like to suggest supporting a way of a lazy-download in the following way:

1. There is a new method {code:java}org.apache.maven.artifact.Artifact.setFileSupplier(Supplier<File> supplier){code} 
2.  {code:java}org.apache.maven.artifact.Artifact.getFile(){code} first checks if there is a file already set, or otherwise init it by calling the supplier if given
3.There is a new method  {code:java}org.apache.maven.artifact.Artifact.hasFile(){code} that returns true if there is either a file set or a file supplier

As there is a close relation with org.eclipse.aether.artifact.Artifact a similar change might be required there as well...



--
This message was sent by Atlassian Jira
(v8.20.10#820010)