BAEL-3929: made changes per code/article review.

This commit is contained in:
Tyrell Flurry 2020-04-27 10:47:52 -04:00
parent b14ab5ed7a
commit f3ce1554c9
4 changed files with 24 additions and 42 deletions

View File

@ -6,6 +6,13 @@
<artifactId>maven-unused-dependencies</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<commons-collections.version>3.2.2</commons-collections.version>
<slf4j-api.version>1.7.25</slf4j-api.version>
<maven-dependency-plugin.version>3.1.1</maven-dependency-plugin.version>
<maven-compiler-plugin.version>3.1</maven-compiler-plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>commons-collections</groupId>
@ -37,11 +44,4 @@
</plugins>
</build>
<properties>
<commons-collections.version>3.2.2</commons-collections.version>
<slf4j-api.version>1.7.25</slf4j-api.version>
<maven-dependency-plugin.version>3.1.1</maven-dependency-plugin.version>
<maven-compiler-plugin.version>3.1</maven-compiler-plugin.version>
</properties>
</project>

View File

@ -1,20 +0,0 @@
package com.baeldung;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.LoggerFactory;
public class Main {
public static void main(String[] args) {
Map<String, String> map = new HashMap<>();
map.put("Dallas", "Texas");
map.put("Green Bay", "Wisconsin");
map.put("Seattle", "Washington");
LoggerFactory.getLogger(Main.class)
.info("Map: {}", map);
}
}

View File

@ -1,15 +0,0 @@
package com.baeldung;
public class ReflectionMain {
public static void main(String[] args) {
ClassLoader classLoader = Main.class.getClassLoader();
try {
System.out.println(classLoader.loadClass("org.apache.commons.collections.CollectionUtils")
.getSimpleName());
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
}

View File

@ -0,0 +1,17 @@
package com.baeldung.mavendependencyplugin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class UnusedDependenciesExample {
/**
* When the Maven dependency analyzer analyzes the code, it will see that the slf4j dependency is being used in this method.
*
* @return the slf4j {@link Logger}.
*/
public Logger getLogger() {
return LoggerFactory.getLogger(UnusedDependenciesExample.class);
}
}