use of org.springframework.boot.loader.tools.Library in project spring-boot by spring-projects.
the class ArtifactsLibraries method doWithLibraries.
@Override
public void doWithLibraries(LibraryCallback callback) throws IOException {
Set<String> duplicates = getDuplicates(this.artifacts);
for (Artifact artifact : this.artifacts) {
LibraryScope scope = SCOPES.get(artifact.getScope());
if (scope != null && artifact.getFile() != null) {
String name = getFileName(artifact);
if (duplicates.contains(name)) {
this.log.debug("Duplicate found: " + name);
name = artifact.getGroupId() + "-" + name;
this.log.debug("Renamed to: " + name);
}
callback.library(new Library(name, artifact.getFile(), scope, isUnpackRequired(artifact)));
}
}
}
use of org.springframework.boot.loader.tools.Library in project spring-boot by spring-projects.
the class ArtifactsLibrariesTests method callbackForJars.
@Test
public void callbackForJars() throws Exception {
given(this.artifact.getType()).willReturn("jar");
given(this.artifact.getScope()).willReturn("compile");
this.libs.doWithLibraries(this.callback);
verify(this.callback).library(this.libraryCaptor.capture());
Library library = this.libraryCaptor.getValue();
assertThat(library.getFile()).isEqualTo(this.file);
assertThat(library.getScope()).isEqualTo(LibraryScope.COMPILE);
assertThat(library.isUnpackRequired()).isFalse();
}
Aggregations