Example usage for org.springframework.boot.loader.tools LibraryCallback library

List of usage examples for org.springframework.boot.loader.tools LibraryCallback library

Introduction

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

Prototype

void library(Library library) throws IOException;

Source Link

Document

Callback for a single library backed by a File .

Usage

From source file:org.eclipse.cft.server.standalone.ui.internal.application.JarArchivingUIHandler.java

protected void bootRepackage(final IPackageFragmentRoot[] roots, File packagedFile) throws CoreException {
    Repackager bootRepackager = new Repackager(packagedFile);
    try {//from  ww w.  j  ava2 s  .  com
        bootRepackager.repackage(new Libraries() {

            public void doWithLibraries(LibraryCallback callBack) throws IOException {
                for (IPackageFragmentRoot root : roots) {

                    if (root.isArchive()) {

                        File rootFile = new File(root.getPath().toOSString());
                        if (rootFile.exists()) {
                            callBack.library(new Library(rootFile, LibraryScope.COMPILE));
                        }
                    }
                }
            }
        });
    } catch (IOException e) {
        errorHandler.handleApplicationDeploymentFailure(
                NLS.bind(Messages.JavaCloudFoundryArchiver_ERROR_REPACKAGE_SPRING, e.getMessage()));
    }
}