1 package org.apache.maven.resolver.examples.util;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.util.ArrayList;
23 import java.util.Arrays;
24 import java.util.List;
25
26 import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
27 import org.eclipse.aether.DefaultRepositorySystemSession;
28 import org.eclipse.aether.RepositorySystem;
29 import org.eclipse.aether.RepositorySystemSession;
30 import org.eclipse.aether.repository.LocalRepository;
31 import org.eclipse.aether.repository.RemoteRepository;
32
33
34
35
36 public class Booter
37 {
38
39 public static RepositorySystem newRepositorySystem()
40 {
41 return org.apache.maven.resolver.examples.manual.ManualRepositorySystemFactory.newRepositorySystem();
42
43
44
45 }
46
47 public static DefaultRepositorySystemSession newRepositorySystemSession( RepositorySystem system )
48 {
49 DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
50
51 LocalRepository localRepo = new LocalRepository( "target/local-repo" );
52 session.setLocalRepositoryManager( system.newLocalRepositoryManager( session, localRepo ) );
53
54 session.setTransferListener( new ConsoleTransferListener() );
55 session.setRepositoryListener( new ConsoleRepositoryListener() );
56
57
58
59
60 return session;
61 }
62
63 public static List<RemoteRepository> newRepositories( RepositorySystem system, RepositorySystemSession session )
64 {
65 return new ArrayList<RemoteRepository>( Arrays.asList( newCentralRepository() ) );
66 }
67
68 private static RemoteRepository newCentralRepository()
69 {
70 return new RemoteRepository.Builder( "central", "default", "https://repo.maven.apache.org/maven2/" ).build();
71 }
72
73 }