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