Skip to content

Commit 698672e

Browse files
committed
Merge branch '2.3.x' into 2.4.x
Closes gh-25182
2 parents f5176f3 + 82dc2df commit 698672e

File tree

2 files changed

+47
-3
lines changed

2 files changed

+47
-3
lines changed

spring-boot-project/spring-boot-cli/src/intTest/java/org/springframework/boot/cli/infrastructure/CommandLineInvoker.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -83,8 +83,8 @@ private Process runCliProcess(String... args) throws IOException {
8383
private File findLaunchScript() throws IOException {
8484
File unpacked = new File(this.temp, "unpacked-cli");
8585
if (!unpacked.isDirectory()) {
86-
File zip = new File(new BuildOutput(getClass()).getRootLocation(), "distributions")
87-
.listFiles((pathname) -> pathname.getName().endsWith("-bin.zip"))[0];
86+
File zip = new File(new BuildOutput(getClass()).getRootLocation(),
87+
"distributions/spring-boot-cli-" + Versions.getBootVersion() + "-bin.zip");
8888
try (ZipInputStream input = new ZipInputStream(new FileInputStream(zip))) {
8989
ZipEntry entry;
9090
while ((entry = input.getNextEntry()) != null) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Copyright 2012-2021 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.boot.cli.infrastructure;
18+
19+
import java.io.FileInputStream;
20+
import java.io.IOException;
21+
import java.util.Properties;
22+
23+
/**
24+
* Provides access to the current Boot version by referring to {@code gradle.properties}.
25+
*
26+
* @author Andy Wilkinson
27+
*/
28+
final class Versions {
29+
30+
private Versions() {
31+
}
32+
33+
static String getBootVersion() {
34+
Properties gradleProperties = new Properties();
35+
try (FileInputStream input = new FileInputStream("../../gradle.properties")) {
36+
gradleProperties.load(input);
37+
return gradleProperties.getProperty("version");
38+
}
39+
catch (IOException ex) {
40+
throw new RuntimeException(ex);
41+
}
42+
}
43+
44+
}

0 commit comments

Comments
 (0)