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 import org.apache.maven.cli.logging.BaseSlf4jConfiguration;
25 import org.slf4j.Logger;
26 import org.slf4j.LoggerFactory;
27
28
29
30
31
32
33
34 public class UnsupportedSlf4jBindingConfiguration extends BaseSlf4jConfiguration {
35 private static final Logger LOGGER = LoggerFactory.getLogger(UnsupportedSlf4jBindingConfiguration.class);
36
37 private String slf4jBinding;
38
39 private Map<URL, Set<Object>> supported;
40
41 public UnsupportedSlf4jBindingConfiguration(String slf4jBinding, Map<URL, Set<Object>> supported) {
42 this.slf4jBinding = slf4jBinding;
43 this.supported = supported;
44 }
45
46 @Override
47 public void activate() {
48 LOGGER.warn("The SLF4J binding actually used is not supported by Maven: {}", slf4jBinding);
49 LOGGER.warn("Maven supported bindings are:");
50
51 String ls = System.lineSeparator();
52
53 for (Map.Entry<URL, Set<Object>> entry : supported.entrySet()) {
54 StringBuilder sb = new StringBuilder();
55 sb.append("(from ").append(entry.getKey().toExternalForm()).append(')');
56
57 for (Object binding : entry.getValue()) {
58 sb.append(ls).append("- ").append(binding);
59 }
60
61 LOGGER.warn(sb.toString());
62 }
63 }
64 }