Example usage for org.springframework.boot.loader.tools LibraryScope COMPILE

List of usage examples for org.springframework.boot.loader.tools LibraryScope COMPILE

Introduction

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

Prototype

LibraryScope COMPILE

To view the source code for org.springframework.boot.loader.tools LibraryScope COMPILE.

Click Source Link

Document

The library is used at compile time and runtime.

Usage

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

@Test
public void existingEntryThatMatchesUnpackLibraryIsMarkedForUnpack() throws IOException {
    File library = createLibrary();
    this.testJarFile.addClass("WEB-INF/classes/com/example/Application.class", ClassWithMainMethod.class);
    this.testJarFile.addFile("WEB-INF/lib/" + library.getName(), library);
    File source = this.testJarFile.getFile("war");
    File dest = this.temporaryFolder.newFile("dest.war");
    Repackager repackager = new Repackager(source);
    repackager.setLayout(new Layouts.War());
    repackager.repackage(dest,//  w  w  w  .j a v  a 2 s  . co m
            (callback) -> callback.library(new Library(library, LibraryScope.COMPILE, true)));
    assertThat(getEntryNames(dest)).containsSubsequence("org/springframework/boot/loader/",
            "WEB-INF/classes/com/example/Application.class", "WEB-INF/lib/" + library.getName());
    JarEntry unpackLibrary = getEntry(dest, "WEB-INF/lib/" + library.getName());
    assertThat(unpackLibrary.getComment()).startsWith("UNPACK:");
}