Jar files added after build time should be added to classpath

Fixes gh-19973
This commit is contained in:
Madhura Bhave
2020-01-29 15:37:37 -08:00
parent b281af0b9b
commit bceed1305f
4 changed files with 46 additions and 7 deletions

View File

@@ -72,6 +72,13 @@ final class ClassPathIndexFile {
return this.folders.contains(name);
}
boolean containsEntry(String name) {
if (name == null || name.isEmpty()) {
return false;
}
return this.lines.contains(name);
}
List<URL> getUrls() {
return Collections.unmodifiableList(this.lines.stream().map(this::asUrl).collect(Collectors.toList()));
}

View File

@@ -101,17 +101,18 @@ public abstract class ExecutableArchiveLauncher extends Launcher {
@Override
protected Iterator<Archive> getClassPathArchivesIterator() throws Exception {
Archive.EntryFilter searchFilter = (entry) -> isSearchCandidate(entry) && !isFolderIndexed(entry);
Iterator<Archive> archives = this.archive.getNestedArchives(searchFilter, this::isNestedArchive);
Archive.EntryFilter searchFilter = this::isSearchCandidate;
Iterator<Archive> archives = this.archive.getNestedArchives(searchFilter,
(entry) -> isNestedArchive(entry) && !isEntryIndexed(entry));
if (isPostProcessingClassPathArchives()) {
archives = applyClassPathArchivePostProcessing(archives);
}
return archives;
}
private boolean isFolderIndexed(Archive.Entry entry) {
private boolean isEntryIndexed(Archive.Entry entry) {
if (this.classPathIndex != null) {
return this.classPathIndex.containsFolder(entry.getName());
return this.classPathIndex.containsEntry(entry.getName());
}
return false;
}