Yes, in that case, if you want to go "full resolver 2" way in Jack, I'd do
following:
- create a "root" session
- derive your own session from root (nested/derived session)
- used derived session
- once done, close derived and close root session

I don't see what CacheLocalRepositoryManager does, I guess it is new?
Is not in https://github.com/Goldmensch/jack

T

On Fri, Jul 12, 2024 at 12:17 PM Nick Hensel <nickhense...@icloud.com>
wrote:

> Thanks for the fast reply :)
>
> Actually the examples set the paths of the local repository instead of
> the LocalRepositoryManager directly. My problem here is, that I'm actually
>
> using an own implementation of LocalRepositoryManager that wraps 2
> instances of EnhancedLocalRepositoryManager. I forgot to include that in
> my example code, my bad.
>
>
> Here's an update version of the code I want to run:
>
> ```java
>
> RepositorySystemSession session = repositorySystem.createSessionBuilder()
>
> .setLocalRepositoryManager(new
> CacheLocalRepositoryManager(userConf.caching().global(), SESSION,
> repositorySystem)).build();
> ```
>
>
> The contructor of CacheLocalRepositoryManager looks like that:
>
> ```java
>
> CacheLocalRepositoryManager(Global conf, RepositorySystemSession
> session, RepositorySystem system) {
>
>   this.conf = conf;
>
> this.local = system.newLocalRepositoryManager(session, new
> LocalRepository(SpecialPaths.JACK_DIR.resolve(MAVEN_DIR)));
>
> this.global = system.newLocalRepositoryManager(session, new
> LocalRepository(SpecialPaths.GLOBAL_JACK_DIR.resolve(MAVEN_DIR))); }
> ```
>
>   I don't know where to get the SESSION from at this early point.
>
> On 12.07.24 11:50, Tamás Cservenák wrote:
> > Also, check out demo snippets:
> >
> https://github.com/apache/maven-resolver/blob/d13019ce5fa38c0951ca0fb0c62a3f5f1254cffc/maven-resolver-demos/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/Booter.java#L68
> >
> > T
> >
> > On Fri, Jul 12, 2024 at 11:45 AM Tamás Cservenák <ta...@cservenak.net>
> > wrote:
> >
> >> Howdy,
> >>
> >> see here and below:
> >>
> >>
> https://github.com/apache/maven-resolver/blob/d13019ce5fa38c0951ca0fb0c62a3f5f1254cffc/maven-resolver-api/src/main/java/org/eclipse/aether/RepositorySystemSession.java#L439
> >>
> >>
> >> T
> >>
> >> On Fri, Jul 12, 2024 at 11:29 AM Nick Hensel
> >> <nickhense...@icloud.com.invalid> wrote:
> >>
> >>> Hi,
> >>> I'm currently migrating my Maven Artifact Resolver 1.x code to 2.0.
> >>> As of version 2.0 the recommend way to create a RepositorySystemSession
> >>> is through a SessionBuilder.
> >>> In my case, I need to set an own LocalRepositoryManager, which wraps
> two
> >>> EnhancedLocalRepositoryManager instanced. The problem here is, that in
> >>> order to create an instance of it I have to call
> >>> RepositorySystem#newLocalRepositoryManager which needs a
> >>> RepositorySystemSession, which I obviously cannot pass before creating
> it.
> >>>
> >>> To demonstrate this problem, here's a piece of code.
> >>> ```java
> >>> RepositorySystemSession session =
> >>> repositorySystem.createSessionBuilder()
> >>>
> .setLocalRepositoryManager(repositorySystem.newLocalRepositoryManager(SESSION,
> >>> new LocalRepository(...)) // where should I get SESSION from?
> >>> ```
> >>>
> >>> Best regards,
> >>>
>

Reply via email to