[ https://issues.apache.org/jira/browse/MNG-8207?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17872887#comment-17872887 ]
Tamas Cservenak edited comment on MNG-8207 at 8/12/24 11:24 AM: ---------------------------------------------------------------- Another option is "chained local repository" (not documented yet), see here: https://github.com/apache/maven/blob/maven-3.9.x/maven-core/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java#L76-L83 In short, "chained local repository" is a list of directories, where: * queries (reads) happens in list order (head then tail), first directory, then 2nd, etc * installs (writes) happens ALWAYS to head In short, if you build with empty head, but shared tail, it could also work. Note: chained is not best suited for your use case, is if something needs to be resolved, it would be also installed into HEAD. Hence, "split repository" is I guess what you want. was (Author: cstamas): Another option is "chained local repository" (not documented yet), see here: https://github.com/apache/maven/blob/maven-3.9.x/maven-core/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java#L76-L83 In short, "chained local repository" is a list of directories, where: * queries (reads) happens in list order (head then tail), first directory, then 2nd, etc * installs (writes) happens ALWAYS to head In short, if you build with empty head, but shared tail, it could also work. > Support 2 level local maven repo, one for downloading, the other for local > install > ---------------------------------------------------------------------------------- > > Key: MNG-8207 > URL: https://issues.apache.org/jira/browse/MNG-8207 > Project: Maven > Issue Type: New Feature > Components: Artifacts and Repositories > Affects Versions: waiting-for-feedback > Reporter: wei cai > Priority: Major > > Our CI solution is based on K8s. All builds happen in a worker pod created > from scratch and will be reclaimed once job completes. When the CI worker pod > is created, a dir path on the host (which the pod belongs) will be mounted to > the pod which serves as the shared maven repo path to reduce downloads. > > The current problem we are facing is: > * As multiple projects build shared the same maven repo path, when some > project executes mvn install, artifacts will be installed to local maven > repo. The artifacts installed might be having some issues and are > inconsistent with the artifacts in remote repo, which would pollute the Maven > shared cache and affect other builds. > > We expect to support: > * Support two local repos, one is the shared local repo which is for > downloading all artifacts from remote repo, and the other is the application > level maven local repo where all project artifacts will be installed to. > * When the install command is executed, the artifacts built will be written > into the application level maven local repo and will never pollute the shared > one. > Is this currently possible? I don't find any useful doc or guide could solve > the polluted cache issue. -- This message was sent by Atlassian Jira (v8.20.10#820010)