|
19 | 19 |
|
20 | 20 | import eu.maveniverse.maven.mima.context.Context;
|
21 | 21 | import eu.maveniverse.maven.mima.context.ContextOverrides;
|
22 |
| -import eu.maveniverse.maven.mima.context.HTTPProxy; |
23 |
| -import eu.maveniverse.maven.mima.context.MavenSystemHome; |
24 |
| -import eu.maveniverse.maven.mima.context.MavenUserHome; |
25 | 22 | import eu.maveniverse.maven.mima.context.Runtime;
|
26 | 23 | import eu.maveniverse.maven.mima.context.Runtimes;
|
27 | 24 | import eu.maveniverse.maven.toolbox.shared.Output;
|
|
33 | 30 | import java.util.Arrays;
|
34 | 31 | import java.util.HashMap;
|
35 | 32 | import java.util.List;
|
36 |
| -import java.util.Map; |
37 | 33 | import java.util.concurrent.Callable;
|
38 | 34 | import java.util.concurrent.ConcurrentHashMap;
|
39 | 35 | import java.util.function.Supplier;
|
40 | 36 | import org.apache.maven.settings.Proxy;
|
41 | 37 | import org.apache.maven.settings.Settings;
|
42 |
| -import org.eclipse.aether.repository.RemoteRepository; |
43 | 38 | import org.jline.jansi.Ansi;
|
44 | 39 | import org.slf4j.helpers.MessageFormatter;
|
45 | 40 | import picocli.CommandLine;
|
@@ -142,81 +137,10 @@ protected void push(String key, Object object) {
|
142 | 137 | public String[] getVersion() {
|
143 | 138 | return new String[] {
|
144 | 139 | "MIMA " + getRuntime().version(),
|
145 |
| - "Toolbox " + ToolboxCommando.getOrCreate(getContext()).getVersion() |
| 140 | + "Toolbox " + getToolboxCommando(getContext()).getVersion() |
146 | 141 | };
|
147 | 142 | }
|
148 | 143 |
|
149 |
| - protected void mayDumpEnv(Runtime runtime, Context context, boolean verbose) { |
150 |
| - warn( |
151 |
| - "Toolbox {} (MIMA Runtime '{}' version {})", |
152 |
| - ToolboxCommando.getOrCreate(getContext()).getVersion(), |
153 |
| - runtime.name(), |
154 |
| - runtime.version()); |
155 |
| - warn("======="); |
156 |
| - normal(" Maven version {}", runtime.mavenVersion()); |
157 |
| - normal(" Managed {}", runtime.managedRepositorySystem()); |
158 |
| - normal(" Basedir {}", context.basedir()); |
159 |
| - normal(" Offline {}", context.repositorySystemSession().isOffline()); |
160 |
| - |
161 |
| - MavenSystemHome mavenSystemHome = context.mavenSystemHome(); |
162 |
| - normal(""); |
163 |
| - normal(" MAVEN_HOME {}", mavenSystemHome == null ? "undefined" : mavenSystemHome.basedir()); |
164 |
| - if (mavenSystemHome != null) { |
165 |
| - normal(" settings.xml {}", mavenSystemHome.settingsXml()); |
166 |
| - normal(" toolchains.xml {}", mavenSystemHome.toolchainsXml()); |
167 |
| - } |
168 |
| - |
169 |
| - MavenUserHome mavenUserHome = context.mavenUserHome(); |
170 |
| - normal(""); |
171 |
| - normal(" USER_HOME {}", mavenUserHome.basedir()); |
172 |
| - normal(" settings.xml {}", mavenUserHome.settingsXml()); |
173 |
| - normal(" settings-security.xml {}", mavenUserHome.settingsSecurityXml()); |
174 |
| - normal(" local repository {}", mavenUserHome.localRepository()); |
175 |
| - |
176 |
| - normal(""); |
177 |
| - normal(" PROFILES"); |
178 |
| - normal(" Active {}", context.contextOverrides().getActiveProfileIds()); |
179 |
| - normal(" Inactive {}", context.contextOverrides().getInactiveProfileIds()); |
180 |
| - |
181 |
| - normal(""); |
182 |
| - normal(" REMOTE REPOSITORIES"); |
183 |
| - for (RemoteRepository repository : context.remoteRepositories()) { |
184 |
| - if (repository.getMirroredRepositories().isEmpty()) { |
185 |
| - normal(" {}", repository); |
186 |
| - } else { |
187 |
| - normal(" {}, mirror of", repository); |
188 |
| - for (RemoteRepository mirrored : repository.getMirroredRepositories()) { |
189 |
| - normal(" {}", mirrored); |
190 |
| - } |
191 |
| - } |
192 |
| - } |
193 |
| - |
194 |
| - if (context.httpProxy() != null) { |
195 |
| - HTTPProxy proxy = context.httpProxy(); |
196 |
| - normal(""); |
197 |
| - normal(" HTTP PROXY"); |
198 |
| - normal(" url {}://{}:{}", proxy.getProtocol(), proxy.getHost(), proxy.getPort()); |
199 |
| - normal(" nonProxyHosts {}", proxy.getNonProxyHosts()); |
200 |
| - } |
201 |
| - |
202 |
| - if (verbose) { |
203 |
| - verbose(""); |
204 |
| - verbose(" USER PROPERTIES"); |
205 |
| - context.contextOverrides().getUserProperties().entrySet().stream() |
206 |
| - .sorted(Map.Entry.comparingByKey()) |
207 |
| - .forEach(e -> verbose(" {}={}", e.getKey(), e.getValue())); |
208 |
| - verbose(" SYSTEM PROPERTIES"); |
209 |
| - context.contextOverrides().getSystemProperties().entrySet().stream() |
210 |
| - .sorted(Map.Entry.comparingByKey()) |
211 |
| - .forEach(e -> verbose(" {}={}", e.getKey(), e.getValue())); |
212 |
| - verbose(" CONFIG PROPERTIES"); |
213 |
| - context.contextOverrides().getConfigProperties().entrySet().stream() |
214 |
| - .sorted(Map.Entry.comparingByKey()) |
215 |
| - .forEach(e -> verbose(" {}={}", e.getKey(), e.getValue())); |
216 |
| - } |
217 |
| - verbose(""); |
218 |
| - } |
219 |
| - |
220 | 144 | protected Runtime getRuntime() {
|
221 | 145 | return (Runtime) getOrCreate(Runtime.class.getName(), Runtimes.INSTANCE::getRuntime);
|
222 | 146 | }
|
@@ -461,6 +385,10 @@ protected String getLocation(final StackTraceElement e) {
|
461 | 385 | }
|
462 | 386 | }
|
463 | 387 |
|
| 388 | + protected ToolboxCommando getToolboxCommando(Context context) { |
| 389 | + return ToolboxCommando.getOrCreate(getRuntime(), context); |
| 390 | + } |
| 391 | + |
464 | 392 | @Override
|
465 | 393 | public final Integer call() {
|
466 | 394 | Ansi.setEnabled(!batch);
|
|
0 commit comments