Skip to content

Commit ff714f6

Browse files
committed
Update module layout to package custom scope dependencies in lib/
Fixes gh-2187
1 parent 6391973 commit ff714f6

File tree

2 files changed

+11
-1
lines changed
  • spring-boot-tools/spring-boot-loader-tools/src

2 files changed

+11
-1
lines changed

spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layouts.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,19 @@
1717
package org.springframework.boot.loader.tools;
1818

1919
import java.io.File;
20+
import java.util.Arrays;
2021
import java.util.Collections;
2122
import java.util.HashMap;
23+
import java.util.HashSet;
2224
import java.util.Map;
25+
import java.util.Set;
2326

2427
/**
2528
* Common {@link Layout}s.
2629
*
2730
* @author Phillip Webb
2831
* @author Dave Syer
32+
* @author Andy Wilkinson
2933
*/
3034
public class Layouts {
3135

@@ -147,14 +151,18 @@ public boolean isExecutable() {
147151
*/
148152
public static class Module implements Layout {
149153

154+
private static final Set<LibraryScope> LIB_DESTINATION_SCOPES = new HashSet<LibraryScope>(
155+
Arrays.asList(LibraryScope.COMPILE, LibraryScope.RUNTIME,
156+
LibraryScope.CUSTOM));
157+
150158
@Override
151159
public String getLauncherClassName() {
152160
return null;
153161
}
154162

155163
@Override
156164
public String getLibraryDestination(String libraryName, LibraryScope scope) {
157-
if (LibraryScope.COMPILE.equals(scope) || LibraryScope.RUNTIME.equals(scope)) {
165+
if (LIB_DESTINATION_SCOPES.contains(scope)) {
158166
return "lib/";
159167
}
160168
return null;

spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/LayoutsTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ public void moduleLayout() throws Exception {
9191
nullValue());
9292
assertThat(layout.getLibraryDestination("lib.jar", LibraryScope.RUNTIME),
9393
equalTo("lib/"));
94+
assertThat(layout.getLibraryDestination("lib.jar", LibraryScope.CUSTOM),
95+
equalTo("lib/"));
9496
}
9597

9698
}

0 commit comments

Comments
 (0)