1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.cli.logging.impl;
20
21 import java.net.URL;
22 import java.util.Map;
23 import java.util.Set;
24
25 import org.apache.maven.cli.logging.BaseSlf4jConfiguration;
26 import org.slf4j.Logger;
27 import org.slf4j.LoggerFactory;
28
29
30
31
32
33
34
35 public class UnsupportedSlf4jBindingConfiguration extends BaseSlf4jConfiguration {
36 private final Logger logger = LoggerFactory.getLogger(UnsupportedSlf4jBindingConfiguration.class);
37
38 private String slf4jBinding;
39
40 private Map<URL, Set<Object>> supported;
41
42 public UnsupportedSlf4jBindingConfiguration(String slf4jBinding, Map<URL, Set<Object>> supported) {
43 this.slf4jBinding = slf4jBinding;
44 this.supported = supported;
45 }
46
47 @Override
48 public void activate() {
49 logger.warn("The SLF4J binding actually used is not supported by Maven: {}", slf4jBinding);
50 logger.warn("Maven supported bindings are:");
51
52 String ls = System.lineSeparator();
53
54 for (Map.Entry<URL, Set<Object>> entry : supported.entrySet()) {
55 StringBuilder sb = new StringBuilder();
56 sb.append("(from ").append(entry.getKey().toExternalForm()).append(')');
57
58 for (Object binding : entry.getValue()) {
59 sb.append(ls).append("- ").append(binding);
60 }
61
62 logger.warn(sb.toString());
63 }
64 }
65 }