This commit is contained in:
Johnny Lim
2017-09-30 02:47:40 +09:00
committed by Andy Wilkinson
parent bcbf7b5511
commit bfa291f671
16 changed files with 99 additions and 98 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,15 +42,15 @@ import org.springframework.boot.loader.tools.LibraryScope;
*/
public class ArtifactsLibraries implements Libraries {
private static final Map<String, LibraryScope> SCOPES;
private static final Map<String, LibraryScope> scopes;
static {
Map<String, LibraryScope> scopes = new HashMap<String, LibraryScope>();
scopes.put(Artifact.SCOPE_COMPILE, LibraryScope.COMPILE);
scopes.put(Artifact.SCOPE_RUNTIME, LibraryScope.RUNTIME);
scopes.put(Artifact.SCOPE_PROVIDED, LibraryScope.PROVIDED);
scopes.put(Artifact.SCOPE_SYSTEM, LibraryScope.PROVIDED);
SCOPES = Collections.unmodifiableMap(scopes);
Map<String, LibraryScope> libraryScopes = new HashMap<String, LibraryScope>();
libraryScopes.put(Artifact.SCOPE_COMPILE, LibraryScope.COMPILE);
libraryScopes.put(Artifact.SCOPE_RUNTIME, LibraryScope.RUNTIME);
libraryScopes.put(Artifact.SCOPE_PROVIDED, LibraryScope.PROVIDED);
libraryScopes.put(Artifact.SCOPE_SYSTEM, LibraryScope.PROVIDED);
scopes = Collections.unmodifiableMap(libraryScopes);
}
private final Set<Artifact> artifacts;
@@ -70,7 +70,7 @@ public class ArtifactsLibraries implements Libraries {
public void doWithLibraries(LibraryCallback callback) throws IOException {
Set<String> duplicates = getDuplicates(this.artifacts);
for (Artifact artifact : this.artifacts) {
LibraryScope scope = SCOPES.get(artifact.getScope());
LibraryScope scope = scopes.get(artifact.getScope());
if (scope != null && artifact.getFile() != null) {
String name = getFileName(artifact);
if (duplicates.contains(name)) {