Merge branch '2.2.x'
This commit is contained in:
@@ -26,20 +26,20 @@ https://github.com/spring-projects/spring-boot[Spring Boot CLI]
|
|||||||
(2.0.0 or better):
|
(2.0.0 or better):
|
||||||
|
|
||||||
$ spring version
|
$ spring version
|
||||||
Spring CLI v2.2.0.BUILD-SNAPSHOT
|
Spring CLI v2.2.3.RELEASE
|
||||||
|
|
||||||
E.g. for SDKMan users
|
E.g. for SDKMan users
|
||||||
|
|
||||||
```
|
```
|
||||||
$ sdk install springboot 2.2.0.BUILD-SNAPSHOT
|
$ sdk install springboot 2.2.3.RELEASE
|
||||||
$ sdk use springboot 2.2.0.BUILD-SNAPSHOT
|
$ sdk use springboot 2.2.3.RELEASE
|
||||||
```
|
```
|
||||||
|
|
||||||
and install the Spring Cloud plugin
|
and install the Spring Cloud plugin
|
||||||
|
|
||||||
```
|
```
|
||||||
$ mvn install
|
$ mvn install
|
||||||
$ spring install org.springframework.cloud:spring-cloud-cli:2.2.0.BUILD-SNAPSHOT
|
$ spring install org.springframework.cloud:spring-cloud-cli:2.2.0.RELEASE
|
||||||
```
|
```
|
||||||
|
|
||||||
IMPORTANT: **Prerequisites:** to use the encryption and decryption features
|
IMPORTANT: **Prerequisites:** to use the encryption and decryption features
|
||||||
|
|||||||
@@ -19,6 +19,15 @@
|
|||||||
</properties>
|
</properties>
|
||||||
<build>
|
<build>
|
||||||
<sourceDirectory>src/main/asciidoc</sourceDirectory>
|
<sourceDirectory>src/main/asciidoc</sourceDirectory>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<!--skip deploy (this is just a test module) -->
|
||||||
|
<artifactId>maven-deploy-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<skip>true</skip>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<profiles>
|
<profiles>
|
||||||
<profile>
|
<profile>
|
||||||
|
|||||||
@@ -4,20 +4,20 @@ https://github.com/spring-projects/spring-boot[Spring Boot CLI]
|
|||||||
(2.0.0 or better):
|
(2.0.0 or better):
|
||||||
|
|
||||||
$ spring version
|
$ spring version
|
||||||
Spring CLI v2.2.0.BUILD-SNAPSHOT
|
Spring CLI v2.2.3.RELEASE
|
||||||
|
|
||||||
E.g. for SDKMan users
|
E.g. for SDKMan users
|
||||||
|
|
||||||
```
|
```
|
||||||
$ sdk install springboot 2.2.0.BUILD-SNAPSHOT
|
$ sdk install springboot 2.2.3.RELEASE
|
||||||
$ sdk use springboot 2.2.0.BUILD-SNAPSHOT
|
$ sdk use springboot 2.2.3.RELEASE
|
||||||
```
|
```
|
||||||
|
|
||||||
and install the Spring Cloud plugin
|
and install the Spring Cloud plugin
|
||||||
|
|
||||||
```
|
```
|
||||||
$ mvn install
|
$ mvn install
|
||||||
$ spring install org.springframework.cloud:spring-cloud-cli:2.2.0.BUILD-SNAPSHOT
|
$ spring install org.springframework.cloud:spring-cloud-cli:2.2.0.RELEASE
|
||||||
```
|
```
|
||||||
|
|
||||||
IMPORTANT: **Prerequisites:** to use the encryption and decryption features
|
IMPORTANT: **Prerequisites:** to use the encryption and decryption features
|
||||||
|
|||||||
2
pom.xml
2
pom.xml
@@ -111,7 +111,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-dependencies</artifactId>
|
<artifactId>spring-boot-dependencies</artifactId>
|
||||||
<version>${spring-boot.version}</version>
|
<version>${spring-boot-do-not-replace-with-releaser.version}</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|||||||
@@ -61,7 +61,7 @@
|
|||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
<maven-antrun-plugin.version>1.8</maven-antrun-plugin.version>
|
<maven-antrun-plugin.version>1.8</maven-antrun-plugin.version>
|
||||||
<maven.version>3.5.4</maven.version>
|
<maven.version>3.6.3</maven.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -0,0 +1,127 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2012-2014 the original author or authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.springframework.cloud.cli.command.url;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.io.PrintStream;
|
||||||
|
|
||||||
|
import org.junit.rules.TestRule;
|
||||||
|
import org.junit.runner.Description;
|
||||||
|
import org.junit.runners.model.Statement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Capture output from System.out and System.err.
|
||||||
|
*
|
||||||
|
* @author Phillip Webb
|
||||||
|
*/
|
||||||
|
public class OutputCapture implements TestRule {
|
||||||
|
|
||||||
|
private CaptureOutputStream captureOut;
|
||||||
|
|
||||||
|
private CaptureOutputStream captureErr;
|
||||||
|
|
||||||
|
private ByteArrayOutputStream copy;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Statement apply(final Statement base, Description description) {
|
||||||
|
return new Statement() {
|
||||||
|
@Override
|
||||||
|
public void evaluate() throws Throwable {
|
||||||
|
captureOutput();
|
||||||
|
try {
|
||||||
|
base.evaluate();
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
releaseOutput();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void captureOutput() {
|
||||||
|
this.copy = new ByteArrayOutputStream();
|
||||||
|
this.captureOut = new CaptureOutputStream(System.out, this.copy);
|
||||||
|
this.captureErr = new CaptureOutputStream(System.err, this.copy);
|
||||||
|
System.setOut(new PrintStream(this.captureOut));
|
||||||
|
System.setErr(new PrintStream(this.captureErr));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void releaseOutput() {
|
||||||
|
System.setOut(this.captureOut.getOriginal());
|
||||||
|
System.setErr(this.captureErr.getOriginal());
|
||||||
|
this.copy = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void flush() {
|
||||||
|
try {
|
||||||
|
this.captureOut.flush();
|
||||||
|
this.captureErr.flush();
|
||||||
|
}
|
||||||
|
catch (IOException ex) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
flush();
|
||||||
|
return this.copy.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class CaptureOutputStream extends OutputStream {
|
||||||
|
|
||||||
|
private final PrintStream original;
|
||||||
|
|
||||||
|
private final OutputStream copy;
|
||||||
|
|
||||||
|
CaptureOutputStream(PrintStream original, OutputStream copy) {
|
||||||
|
this.original = original;
|
||||||
|
this.copy = copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(int b) throws IOException {
|
||||||
|
this.copy.write(b);
|
||||||
|
this.original.write(b);
|
||||||
|
this.original.flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(byte[] b) throws IOException {
|
||||||
|
write(b, 0, b.length);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(byte[] b, int off, int len) throws IOException {
|
||||||
|
this.copy.write(b, off, len);
|
||||||
|
this.original.write(b, off, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PrintStream getOriginal() {
|
||||||
|
return this.original;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void flush() throws IOException {
|
||||||
|
this.copy.flush();
|
||||||
|
this.original.flush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.version>3.5.4</maven.version>
|
<maven.version>3.6.3</maven.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
@@ -55,7 +55,8 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.codehaus.plexus</groupId>
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
<artifactId>plexus-utils</artifactId>
|
<artifactId>plexus-utils</artifactId>
|
||||||
<version>3.1.0</version>
|
<!-- Compatible with Maven -->
|
||||||
|
<version>3.2.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- FIXME: 3.0.0 missing classes running tests -->
|
<!-- FIXME: 3.0.0 missing classes running tests -->
|
||||||
<!--<dependency>
|
<!--<dependency>
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public class LauncherCommand extends OptionParsingCommand {
|
|||||||
|
|
||||||
public static final Log log = LogFactory.getLog(LauncherCommand.class);
|
public static final Log log = LogFactory.getLog(LauncherCommand.class);
|
||||||
|
|
||||||
private static final String DEFAULT_VERSION = "2.2.0.BUILD-SNAPSHOT";
|
private static final String DEFAULT_VERSION = "2.2.0.RELEASE";
|
||||||
|
|
||||||
private static final Collection<HelpExample> EXAMPLES = new ArrayList<>();
|
private static final Collection<HelpExample> EXAMPLES = new ArrayList<>();
|
||||||
|
|
||||||
|
|||||||
@@ -92,6 +92,12 @@
|
|||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
|||||||
@@ -16,6 +16,9 @@
|
|||||||
|
|
||||||
package org.springframework.cloud.launcher.deployer;
|
package org.springframework.cloud.launcher.deployer;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@@ -31,7 +34,10 @@ import org.springframework.boot.builder.SpringApplicationBuilder;
|
|||||||
import org.springframework.boot.logging.LogLevel;
|
import org.springframework.boot.logging.LogLevel;
|
||||||
import org.springframework.boot.logging.logback.LogbackLoggingSystem;
|
import org.springframework.boot.logging.logback.LogbackLoggingSystem;
|
||||||
import org.springframework.context.ConfigurableApplicationContext;
|
import org.springframework.context.ConfigurableApplicationContext;
|
||||||
|
import org.springframework.core.io.ClassPathResource;
|
||||||
import org.springframework.util.ClassUtils;
|
import org.springframework.util.ClassUtils;
|
||||||
|
import org.springframework.util.ReflectionUtils;
|
||||||
|
import org.springframework.util.StreamUtils;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,8 +48,6 @@ public class DeployerApplication {
|
|||||||
private static final Logger logger = LoggerFactory
|
private static final Logger logger = LoggerFactory
|
||||||
.getLogger(DeployerApplication.class);
|
.getLogger(DeployerApplication.class);
|
||||||
|
|
||||||
private static final String DEFAULT_VERSION = "2.2.0.BUILD-SNAPSHOT";
|
|
||||||
|
|
||||||
private String[] args;
|
private String[] args;
|
||||||
|
|
||||||
public DeployerApplication(String... args) {
|
public DeployerApplication(String... args) {
|
||||||
@@ -103,8 +107,19 @@ public class DeployerApplication {
|
|||||||
|
|
||||||
String getVersion() {
|
String getVersion() {
|
||||||
Package pkg = DeployerApplication.class.getPackage();
|
Package pkg = DeployerApplication.class.getPackage();
|
||||||
return (pkg != null ? pkg.getImplementationVersion() == null ? DEFAULT_VERSION
|
return (pkg != null ? pkg.getImplementationVersion() == null ? getDefaultVersion()
|
||||||
: pkg.getImplementationVersion() : DEFAULT_VERSION);
|
: pkg.getImplementationVersion() : getDefaultVersion());
|
||||||
|
}
|
||||||
|
|
||||||
|
String getDefaultVersion() {
|
||||||
|
try (InputStream in = new ClassPathResource("META-INF/cli-version.txt").getInputStream()) {
|
||||||
|
return StreamUtils.copyToString(in, StandardCharsets.UTF_8);
|
||||||
|
}
|
||||||
|
catch (IOException e) {
|
||||||
|
ReflectionUtils.rethrowRuntimeException(e);
|
||||||
|
}
|
||||||
|
// not reachable since exception rethrown at runtime
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void launch() {
|
private void launch() {
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
@project.version@
|
||||||
@@ -22,8 +22,7 @@ import org.junit.Test;
|
|||||||
|
|
||||||
import org.springframework.boot.test.system.OutputCaptureRule;
|
import org.springframework.boot.test.system.OutputCaptureRule;
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.containsString;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.junit.Assert.assertThat;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Spencer Gibb
|
* @author Spencer Gibb
|
||||||
@@ -38,28 +37,35 @@ public class DeployerApplicationTests {
|
|||||||
public void testDefaultLibrary() throws Exception {
|
public void testDefaultLibrary() throws Exception {
|
||||||
DeployerApplication wrapper = new DeployerApplication();
|
DeployerApplication wrapper = new DeployerApplication();
|
||||||
if (System.getProperty("project.version") != null) {
|
if (System.getProperty("project.version") != null) {
|
||||||
assertThat(wrapper.getVersion(),
|
assertThat(wrapper.getVersion())
|
||||||
containsString(System.getProperty("project.version")));
|
.contains(System.getProperty("project.version"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateClassLoaderAndListDeployables() throws Exception {
|
public void testCreateClassLoaderAndListDeployables() throws Exception {
|
||||||
new DeployerApplication("--launcher.list=true").run();
|
new DeployerApplication("--launcher.list=true").run();
|
||||||
assertThat(output.toString(), containsString("configserver"));
|
assertThat(output.toString()).contains("configserver");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNonOptionArgsPassedDown() throws Exception {
|
public void testNonOptionArgsPassedDown() throws Exception {
|
||||||
new DeployerApplication("--launcher.list=true", "--spring.profiles.active=test")
|
new DeployerApplication("--launcher.list=true", "--spring.profiles.active=test")
|
||||||
.run();
|
.run();
|
||||||
assertThat(output.toString(), containsString("foo"));
|
assertThat(output.toString()).contains("foo");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testInvalidDeployableFails() throws Exception {
|
public void testInvalidDeployableFails() throws Exception {
|
||||||
new DeployerApplication("--launcher.deploy=foo,bar").run();
|
new DeployerApplication("--launcher.deploy=foo,bar").run();
|
||||||
assertThat(output.toString(),
|
assertThat(output.toString())
|
||||||
containsString("The following are not valid: 'foo,bar'"));
|
.contains("The following are not valid: 'foo,bar'");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void defaultVersionReadFromFile() {
|
||||||
|
String defaultVersion = new DeployerApplication("--launcher.deploy=foo,bar").getDefaultVersion();
|
||||||
|
// starts with one or more digits then a .
|
||||||
|
assertThat(defaultVersion).isNotBlank().containsPattern("^\\d+\\..*");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user