1 package org.apache.maven.execution;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.File;
23 import java.util.ArrayList;
24 import java.util.List;
25
26 import org.apache.maven.settings.Mirror;
27 import org.apache.maven.settings.Profile;
28 import org.apache.maven.settings.Proxy;
29 import org.apache.maven.settings.RuntimeInfo;
30 import org.apache.maven.settings.Server;
31 import org.apache.maven.settings.Settings;
32 import org.apache.maven.settings.SettingsUtils;
33
34
35
36
37
38
39
40
41
42 class SettingsAdapter
43 extends Settings
44 {
45
46 private MavenExecutionRequest request;
47
48 private RuntimeInfo runtimeInfo;
49
50 SettingsAdapter( MavenExecutionRequest request )
51 {
52 this.request = request;
53
54
55
56
57
58
59 File userSettings = request.getUserSettingsFile();
60 this.runtimeInfo = new RuntimeInfo( ( userSettings != null && userSettings.isFile() ) ? userSettings : null );
61 }
62
63 @Override
64 public String getLocalRepository()
65 {
66 if ( request.getLocalRepositoryPath() != null )
67 {
68 return request.getLocalRepositoryPath().getAbsolutePath();
69 }
70
71 return null;
72 }
73
74 @Override
75 public boolean isInteractiveMode()
76 {
77 return request.isInteractiveMode();
78 }
79
80 @Override
81 public boolean isOffline()
82 {
83 return request.isOffline();
84 }
85
86 @Override
87 public List<Proxy> getProxies()
88 {
89 return request.getProxies();
90 }
91
92 @Override
93 public List<Server> getServers()
94 {
95 return request.getServers();
96 }
97
98 @Override
99 public List<Mirror> getMirrors()
100 {
101 return request.getMirrors();
102 }
103
104 @Override
105 public List<Profile> getProfiles()
106 {
107 List<Profile> result = new ArrayList<>();
108 for ( org.apache.maven.model.Profile profile : request.getProfiles() )
109 {
110 result.add( SettingsUtils.convertToSettingsProfile( profile ) );
111 }
112 return result;
113 }
114
115 @Override
116 public List<String> getActiveProfiles()
117 {
118 return request.getActiveProfiles();
119 }
120
121 @Override
122 public List<String> getPluginGroups()
123 {
124 return request.getPluginGroups();
125 }
126 }