Update classpath index to use jar name instead of full path

See gh-20564
This commit is contained in:
Madhura Bhave
2020-03-25 10:46:10 -07:00
parent 2ceec65b5d
commit ad164269e9
7 changed files with 25 additions and 57 deletions

View File

@@ -28,6 +28,7 @@ import java.util.concurrent.TimeUnit;
import java.util.jar.Attributes;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
import java.util.stream.Collectors;
import org.apache.commons.compress.archivers.jar.JarArchiveEntry;
@@ -492,7 +493,9 @@ public abstract class Packager {
}
if (getLayout() instanceof RepackagingLayout) {
String location = ((RepackagingLayout) getLayout()).getClasspathIndexFileLocation();
writer.writeIndexFile(location, this.libraries.keySet());
List<String> names = this.libraries.keySet().stream()
.map((key) -> key.substring(key.lastIndexOf('/') + 1)).collect(Collectors.toList());
writer.writeIndexFile(location, names);
}
}