Package org.elasticsearch.bootstrap
Class JarHell
- java.lang.Object
-
- org.elasticsearch.bootstrap.JarHell
-
public class JarHell extends Object
Simple check for duplicate class files across the classpath.This class checks for incompatibilities in the following ways:
- Checks that class files are not duplicated across jars.
- Checks any
X-Compile-Target-JDKvalue in the jar manifest is compatible with current JRE - Checks any
X-Compile-Elasticsearch-Versionvalue in the jar manifest is compatible with the current ES
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcheckJarHell(Consumer<String> output)Checks the current classpath for duplicate classesstatic voidcheckJarHell(Set<URL> urls, Consumer<String> output)Checks the set of URLs for duplicate classesstatic voidcheckJavaVersion(String resource, String targetVersion)Checks that the java specification versiontargetVersionrequired byresourceis compatible with the current installation.static voidcheckVersionFormat(String targetVersion)static voidmain(String[] args)Simple driver class, can be used eg.static Set<URL>parseClassPath()Parses the classpath into an array of URLs
-
-
-
Method Detail
-
main
public static void main(String[] args) throws Exception
Simple driver class, can be used eg. from builds. Returns non-zero on jar-hell- Throws:
Exception
-
checkJarHell
public static void checkJarHell(Consumer<String> output) throws IOException, URISyntaxException
Checks the current classpath for duplicate classes- Parameters:
output- AStringConsumerto which debug output will be sent- Throws:
IllegalStateException- if jar hell was foundIOExceptionURISyntaxException
-
parseClassPath
public static Set<URL> parseClassPath()
Parses the classpath into an array of URLs- Returns:
- array of URLs
- Throws:
IllegalStateException- if the classpath contains empty elements
-
checkJarHell
public static void checkJarHell(Set<URL> urls, Consumer<String> output) throws URISyntaxException, IOException
Checks the set of URLs for duplicate classes- Parameters:
urls- A set of URLs from the classpath to be checked for conflicting jarsoutput- AStringConsumerto which debug output will be sent- Throws:
IllegalStateException- if jar hell was foundURISyntaxExceptionIOException
-
checkVersionFormat
public static void checkVersionFormat(String targetVersion)
-
-