Fix apache pool2 jar not loading correctly - closes #150

This commit is contained in:
Luck 2017-01-25 22:07:50 +00:00
parent 81c71777cb
commit 73c5a1ad9b
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
3 changed files with 4 additions and 5 deletions

View File

@ -57,7 +57,7 @@
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.8.1</version>
<version>2.9.0</version>
<scope>provided</scope>
</dependency>
<!-- SQLite -->

View File

@ -37,8 +37,7 @@ public enum Dependency {
SLF4J_SIMPLE("https://repo1.maven.org/maven2/org/slf4j/slf4j-simple/1.7.9/slf4j-simple-1.7.9.jar", "1.7.9", "org.slf4j.impl.SimpleLoggerFactory"),
SLF4J_API("https://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.9/slf4j-api-1.7.9.jar", "1.7.9", "org.slf4j.helpers.BasicMarkerFactory"),
MONGODB_DRIVER("https://repo1.maven.org/maven2/org/mongodb/mongo-java-driver/3.4.1/mongo-java-driver-3.4.1.jar", "3.4.1", "com.mongodb.Mongo"),
JEDIS("https://repo1.maven.org/maven2/redis/clients/jedis/2.9.0/jedis-2.9.0.jar", "2.9.0", "redis.clients.jedis.Jedis"),
APACHE_COMMONS_POOL("https://repo1.maven.org/maven2/org/apache/commons/commons-pool2/2.4.2/commons-pool2-2.4.2.jar", "2.4.1", "org.apache.commons.pool2.PoolUtils");
JEDIS("https://github.com/lucko/jedis/releases/download/jedis-2.9.0-shaded/jedis-2.9.0-shaded.jar", "2.9.0-shaded", "redis.clients.jedis.Jedis");
private final String url;
private final String version;

View File

@ -75,7 +75,6 @@ public class DependencyManager {
}
if (plugin.getConfiguration().get(ConfigKeys.REDIS_ENABLED)) {
dependencies.add(Dependency.APACHE_COMMONS_POOL);
dependencies.add(Dependency.JEDIS);
}
@ -109,12 +108,13 @@ public class DependencyManager {
private static File downloadDependency(LuckPermsPlugin plugin, File libDir, Dependency dependency) throws Exception {
String name = dependency.name().toLowerCase() + "-" + dependency.getVersion() + ".jar";
URL url = new URL(dependency.getUrl());
File file = new File(libDir, name);
if (file.exists()) {
return file;
}
URL url = new URL(dependency.getUrl());
plugin.getLog().info("Dependency '" + name + "' could not be found. Attempting to download.");
try (InputStream in = url.openStream()) {
Files.copy(in, file.toPath());