java.lang.Object
org.elasticsearch.jdk.JarHell
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-JDK
value in the jar manifest is compatible with current JRE - Checks any
X-Compile-Elasticsearch-Version
value in the jar manifest is compatible with the current ES
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
checkJarHell
(Consumer<String> output) Checks the current classpath for duplicate classesstatic void
checkJarHell
(Set<URL> urls, Consumer<String> output) Checks the set of URLs for duplicate classesstatic void
checkJavaVersion
(String resource, String targetVersion) Checks that the java specification versiontargetVersion
required byresource
is compatible with the current installation.static void
Simple driver class, can be used eg.Parses the classpath into an array of URLsReturns a set of URLs that contain artifacts from both the non-JDK boot modules and class path.
-
Method Details
-
main
Simple driver class, can be used eg. from builds. Returns non-zero on jar-hell- Throws:
Exception
-
checkJarHell
Checks the current classpath for duplicate classes- Parameters:
output
- AString
Consumer
to which debug output will be sent- Throws:
IllegalStateException
- if jar hell was foundIOException
-
parseClassPath
Parses the classpath into an array of URLs- Returns:
- array of URLs
- Throws:
IllegalStateException
- if the classpath contains empty elements
-
parseModulesAndClassPath
Returns a set of URLs that contain artifacts from both the non-JDK boot modules and class path. These URLs constitute the loadable application artifacts in the system class loader. -
checkJarHell
Checks the set of URLs for duplicate classes- Parameters:
urls
- A set of URLs from the system class loader to be checked for conflicting jarsoutput
- AString
Consumer
to which debug output will be sent- Throws:
IllegalStateException
- if jar hell was foundIOException
-
checkJavaVersion
Checks that the java specification versiontargetVersion
required byresource
is compatible with the current installation.
-