Add jar hell check test for the shaded jar

This commit is contained in:
Robert Muir 2015-08-03 05:54:55 -04:00
parent aaf0976cb7
commit a5a27a5cd9
3 changed files with 31 additions and 0 deletions

View File

@ -47,8 +47,11 @@ import java.util.jar.Manifest;
public class JarHell { public class JarHell {
/** Simple driver class, can be used eg. from builds. Returns non-zero on jar-hell */ /** Simple driver class, can be used eg. from builds. Returns non-zero on jar-hell */
@SuppressForbidden(reason = "command line tool")
public static void main(String args[]) throws Exception { public static void main(String args[]) throws Exception {
System.out.println("checking for jar hell...");
checkJarHell(); checkJarHell();
System.out.println("no jar hell found");
} }
/** /**

View File

@ -276,4 +276,14 @@
<startup-elasticsearch home="${integ.scratch}/rpm-extracted/usr/share/elasticsearch/"/> <startup-elasticsearch home="${integ.scratch}/rpm-extracted/usr/share/elasticsearch/"/>
</target> </target>
<!-- check shaded jar for jar hell -->
<target name="check-for-jar-hell">
<java failonerror="true" fork="true" classname="org.elasticsearch.bootstrap.JarHell">
<classpath>
<pathelement location="${project.build.directory}/${project.artifactId}-${project.version}.jar"/>
<pathelement location="${org.apache.lucene:lucene-core:jar}"/>
</classpath>
</java>
</target>
</project> </project>

View File

@ -38,6 +38,24 @@
</plugins> </plugins>
<pluginManagement> <pluginManagement>
<plugins> <plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>check-for-jar-hell</id>
<phase>integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<ant antfile="${elasticsearch.integ.antfile}" target="check-for-jar-hell"/>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>