Skip to content

Commit 8f27ad9

Browse files
committed
Remove version from name of Ant-built jar
Previously, the project version was included in the name of the Ant-built jar and the integration test assumed that there would be a single jar in the output directory. This assumption did not hold true if the project's version had changed and the project had been built again without a clean. This resulted in two jars, one for the previous version and one for the current version, in the output directory. This caused a test failure. This commit updates the build.xml to remove the version from the name of the Ant-built jar and updates the integration test to find it. Closes gh-22782
1 parent 95b504c commit 8f27ad9

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-ant/build.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
actual jars). Run with '$ java -jar target/*.jar'.
1212
</description>
1313

14-
<property name="lib.dir" location="${basedir}/target/lib" />
14+
<property name="lib.dir" location="${basedir}/build/ant/lib" />
1515
<property name="start-class" value="smoketest.ant.SampleAntApplication" />
1616

1717
<target name="resolve" description="--> retrieve dependencies with ivy">
@@ -37,7 +37,7 @@
3737
</target>
3838

3939
<target name="build" depends="compile">
40-
<spring-boot:exejar destfile="build/ant/libs/${ant.project.name}-${ant-spring-boot.version}.jar" classes="build/ant/classes">
40+
<spring-boot:exejar destfile="build/ant/libs/${ant.project.name}.jar" classes="build/ant/classes">
4141
<spring-boot:lib>
4242
<fileset dir="${lib.dir}/runtime" />
4343
</spring-boot:lib>

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-ant/src/test/java/smoketest/ant/SampleAntApplicationIT.java

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package smoketest.ant;
1818

1919
import java.io.File;
20-
import java.io.FileFilter;
2120
import java.io.InputStreamReader;
2221
import java.util.concurrent.TimeUnit;
2322

@@ -38,17 +37,9 @@ public class SampleAntApplicationIT {
3837

3938
@Test
4039
void runJar() throws Exception {
41-
File target = new File("build/ant/libs");
42-
File[] jarFiles = target.listFiles(new FileFilter() {
43-
44-
@Override
45-
public boolean accept(File file) {
46-
return file.getName().endsWith(".jar");
47-
}
48-
49-
});
50-
assertThat(jarFiles).hasSize(1);
51-
Process process = new JavaExecutable().processBuilder("-jar", jarFiles[0].getName()).directory(target).start();
40+
File libs = new File("build/ant/libs");
41+
Process process = new JavaExecutable().processBuilder("-jar", "spring-boot-smoke-test-ant.jar").directory(libs)
42+
.start();
5243
process.waitFor(5, TimeUnit.MINUTES);
5344
assertThat(process.exitValue()).isEqualTo(0);
5445
String output = FileCopyUtils.copyToString(new InputStreamReader(process.getInputStream()));

0 commit comments

Comments
 (0)