1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.settings.crypto;
20
21 import javax.inject.Inject;
22 import javax.inject.Named;
23 import javax.inject.Singleton;
24
25 import java.nio.file.Path;
26 import java.nio.file.Paths;
27 import java.util.Map;
28
29 import org.apache.maven.api.Constants;
30 import org.codehaus.plexus.components.secdispatcher.Dispatcher;
31 import org.codehaus.plexus.components.secdispatcher.SecDispatcher;
32 import org.codehaus.plexus.components.secdispatcher.internal.DefaultSecDispatcher;
33
34
35
36
37
38
39 @Named
40 @Singleton
41 @Deprecated(since = "4.0.0")
42 public class MavenSecDispatcher extends DefaultSecDispatcher {
43 private static final String FILE_NAME = "settings-security4.xml";
44
45 @Inject
46 public MavenSecDispatcher(Map<String, Dispatcher> dispatchers) {
47 super(dispatchers, configurationFile());
48 }
49
50 private static Path configurationFile() {
51 String mavenUserConf = System.getProperty(Constants.MAVEN_USER_CONF);
52 if (mavenUserConf != null) {
53 return Paths.get(mavenUserConf, FILE_NAME);
54 }
55
56 return Paths.get(System.getProperty("user.home"), ".m2", FILE_NAME);
57 }
58 }