Update module layout to package custom scope dependencies in lib/

Fixes gh-2187
This commit is contained in:
Andy Wilkinson
2014-12-17 20:14:03 +00:00
parent 6391973ed0
commit ff714f6c17
2 changed files with 11 additions and 1 deletions

View File

@@ -17,15 +17,19 @@
package org.springframework.boot.loader.tools;
import java.io.File;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
/**
* Common {@link Layout}s.
*
* @author Phillip Webb
* @author Dave Syer
* @author Andy Wilkinson
*/
public class Layouts {
@@ -147,6 +151,10 @@ public class Layouts {
*/
public static class Module implements Layout {
private static final Set<LibraryScope> LIB_DESTINATION_SCOPES = new HashSet<LibraryScope>(
Arrays.asList(LibraryScope.COMPILE, LibraryScope.RUNTIME,
LibraryScope.CUSTOM));
@Override
public String getLauncherClassName() {
return null;
@@ -154,7 +162,7 @@ public class Layouts {
@Override
public String getLibraryDestination(String libraryName, LibraryScope scope) {
if (LibraryScope.COMPILE.equals(scope) || LibraryScope.RUNTIME.equals(scope)) {
if (LIB_DESTINATION_SCOPES.contains(scope)) {
return "lib/";
}
return null;

View File

@@ -91,6 +91,8 @@ public class LayoutsTests {
nullValue());
assertThat(layout.getLibraryDestination("lib.jar", LibraryScope.RUNTIME),
equalTo("lib/"));
assertThat(layout.getLibraryDestination("lib.jar", LibraryScope.CUSTOM),
equalTo("lib/"));
}
}