commit
ab0cc55e20
|
@ -29,6 +29,7 @@ import java.util.Map;
|
||||||
* @author Dave Syer
|
* @author Dave Syer
|
||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
* @author Madhura Bhave
|
* @author Madhura Bhave
|
||||||
|
* @author Scott Frederick
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public final class Layouts {
|
public final class Layouts {
|
||||||
|
@ -160,11 +161,6 @@ public final class Layouts {
|
||||||
return "WEB-INF/classes/";
|
return "WEB-INF/classes/";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getClasspathIndexFileLocation() {
|
|
||||||
return "WEB-INF/classpath.idx";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getLayersIndexFileLocation() {
|
public String getLayersIndexFileLocation() {
|
||||||
return "WEB-INF/layers.idx";
|
return "WEB-INF/layers.idx";
|
||||||
|
|
|
@ -516,15 +516,15 @@ public abstract class Packager {
|
||||||
writtenPaths.add(path);
|
writtenPaths.add(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getLayout() instanceof RepackagingLayout) {
|
writeClasspathIndexIfNecessary(writtenPaths, getLayout(), writer);
|
||||||
writeClasspathIndex(writtenPaths, (RepackagingLayout) getLayout(), writer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeClasspathIndex(List<String> paths, RepackagingLayout layout, AbstractJarWriter writer)
|
private void writeClasspathIndexIfNecessary(List<String> paths, Layout layout, AbstractJarWriter writer)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
List<String> names = paths.stream().map((path) -> "- \"" + path + "\"").collect(Collectors.toList());
|
if (layout.getClasspathIndexFileLocation() != null) {
|
||||||
writer.writeIndexFile(layout.getClasspathIndexFileLocation(), names);
|
List<String> names = paths.stream().map((path) -> "- \"" + path + "\"").collect(Collectors.toList());
|
||||||
|
writer.writeIndexFile(layout.getClasspathIndexFileLocation(), names);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -213,6 +213,11 @@ abstract class AbstractArchiveIntegrationTests {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ManifestAssert doesNotHaveAttribute(String name) {
|
||||||
|
assertThat(this.actual.getMainAttributes().getValue(name)).isNull();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -365,6 +365,16 @@ class JarIntegrationTests extends AbstractArchiveIntegrationTests {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestTemplate
|
||||||
|
void repackagedJarContainsClasspathIndex(MavenBuild mavenBuild) {
|
||||||
|
mavenBuild.project("jar").execute((project) -> {
|
||||||
|
File repackaged = new File(project, "target/jar-0.0.1.BUILD-SNAPSHOT.jar");
|
||||||
|
assertThat(jar(repackaged)).manifest(
|
||||||
|
(manifest) -> manifest.hasAttribute("Spring-Boot-Classpath-Index", "BOOT-INF/classpath.idx"));
|
||||||
|
assertThat(jar(repackaged)).hasEntryWithName("BOOT-INF/classpath.idx");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
void whenJarIsRepackagedWithOutputTimestampConfiguredThenJarIsReproducible(MavenBuild mavenBuild)
|
void whenJarIsRepackagedWithOutputTimestampConfiguredThenJarIsReproducible(MavenBuild mavenBuild)
|
||||||
throws InterruptedException {
|
throws InterruptedException {
|
||||||
|
|
|
@ -210,6 +210,16 @@ class WarIntegrationTests extends AbstractArchiveIntegrationTests {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestTemplate
|
||||||
|
void repackagedWarDoesNotContainClasspathIndex(MavenBuild mavenBuild) {
|
||||||
|
mavenBuild.project("war").execute((project) -> {
|
||||||
|
File repackaged = new File(project, "target/war-0.0.1.BUILD-SNAPSHOT.war");
|
||||||
|
assertThat(jar(repackaged))
|
||||||
|
.manifest((manifest) -> manifest.doesNotHaveAttribute("Spring-Boot-Classpath-Index"));
|
||||||
|
assertThat(jar(repackaged)).doesNotHaveEntryWithName("BOOT-INF/classpath.idx");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
void whenEntryIsExcludedItShouldNotBePresentInTheRepackagedWar(MavenBuild mavenBuild) {
|
void whenEntryIsExcludedItShouldNotBePresentInTheRepackagedWar(MavenBuild mavenBuild) {
|
||||||
mavenBuild.project("war-exclude-entry").execute((project) -> {
|
mavenBuild.project("war-exclude-entry").execute((project) -> {
|
||||||
|
|
Loading…
Reference in New Issue