public File repackage(String className, Collection<JarFile> jars) {
String name = RandomStringUtils.randomAlphabetic(10) + JarBuilder.JAR_EXTENSION;
tracer.info("Target Jar: {0}", name);
JarBuilder builder = JarBuilder.createJar(name).withCompression();
// Repackage each Jar
for (JarFile jar : jars) {
tracer.info("Repackaging... {0}", jar.getName());
repackageJar(jar, builder);
}
// Package the manifest
tracer.info("Writing manifest...");
String manifest = JarBuilder.createManifest().withMainClass(className).build();
builder.withManifest(manifest);
return builder.build();
}