Example usage for org.springframework.boot.loader.tools JarWriter JarWriter

List of usage examples for org.springframework.boot.loader.tools JarWriter JarWriter

Introduction

In this page you can find the example usage for org.springframework.boot.loader.tools JarWriter JarWriter.

Prototype

public JarWriter(File file, LaunchScript launchScript) throws FileNotFoundException, IOException 

Source Link

Document

Create a new JarWriter instance.

Usage

From source file:org.springframework.boot.loader.tools.Repackager.java

private void repackage(JarFile sourceJar, File destination, Libraries libraries, LaunchScript launchScript)
        throws IOException {
    WritableLibraries writeableLibraries = new WritableLibraries(libraries);
    try (JarWriter writer = new JarWriter(destination, launchScript)) {
        writer.writeManifest(buildManifest(sourceJar));
        writeLoaderClasses(writer);//from  w w w .ja  v a  2  s .c o m
        if (this.layout instanceof RepackagingLayout) {
            writer.writeEntries(sourceJar,
                    new RenamingEntryTransformer(
                            ((RepackagingLayout) this.layout).getRepackagedClassesLocation()),
                    writeableLibraries);
        } else {
            writer.writeEntries(sourceJar, writeableLibraries);
        }
        writeableLibraries.write(writer);
    }
}