附录
遇到 Spring Cloud Skipper 问题,我们想帮忙!
-
提出问题 - 我们会监控 stackoverflow.com 的问题 标记为
spring-cloud-skipper
。 -
在 github.com/spring-cloud/spring-cloud-skipper/issues 报告 Spring Cloud Skipper 的错误。
附录 A:架构
要构建源代码,您需要安装 JDK 1.8。
该版本使用 Maven 包装器,因此您不必安装特定版本的 Maven。
主要的构建命令是
$ ./mvnw clean install
要创建可执行文件并避免运行测试和生成 JavaDocs,请使用以下命令:
$ ./mvnw clean package -DskipTests -Dmaven.javadoc.skip=true
您也可以自己安装 Maven (>=3.3.3) 并运行命令来代替示例中的 。
如果这样做,则如果本地 Maven 设置不包含 Spring 预发布工件的存储库声明,则可能还需要添加。mvn ./mvnw -P spring |
您可能需要通过设置具有类似 .
我们尝试在配置中涵盖这一点,因此,如果您发现必须增加内存才能使构建成功,请提交票证以将设置添加到源代码控制中。MAVEN_OPTS -Xmx512m -XX:MaxPermSize=128m .mvn |
A.1. 文档
要仅生成 REST 文档,请使用以下命令:
$ ./mvnw test -pl spring-cloud-skipper-server-core -Dtest=*Documentation*
要构建唯一的 Asciidoctor 文档,请使用以下命令:
$ ./mvnw package -DskipTests -Pfull -pl spring-cloud-skipper-docs
A.2. 自定义服务器构建
本章包含如何创建自定义服务器的说明 build 并应该导致与 一个来自 Skipper 构建本身。
它需要遵循 Skipper 本身使用的相同 Spring Boot 主类结构。 示例如下所示:
package com.example.customskipperserver;
@SpringBootApplication(exclude = {
CloudFoundryDeployerAutoConfiguration.class,
KubernetesAutoConfiguration.class,
LocalDeployerAutoConfiguration.class,
ManagementWebSecurityAutoConfiguration.class,
SecurityAutoConfiguration.class,
SessionAutoConfiguration.class
})
@EnableSkipperServer
public class CustomSkipperServerApplication {
public static void main(String[] args) {
SpringApplication.run(CustomSkipperServerApplication.class, args);
}
}
Maven 的工作构建文件如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>custom-skipper-server</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>custom-skipper-server</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.18</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>2021.0.9</spring-cloud.version>
<spring-cloud-skipper.version>2.11.5</spring-cloud-skipper.version>
<!--
reactor and flyway are managed by boot so this is an illustration of how to modify the versions since
trying to import boms in dependencyManagement would not actually change versions.
-->
<reactor.version>3.0.7.RELEASE</reactor.version>
<flyway.version>5.0.5</flyway.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-skipper-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-skipper-dependencies</artifactId>
<version>${spring-cloud-skipper.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Gradle 的工作构建文件如下所示:
buildscript {
ext {
springBootVersion = '2.7.18'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenLocal()
mavenCentral()
maven { url "https://repo.springsource.org/libs-snapshot" }
maven { url "https://repo.springsource.org/libs-release" }
maven { url "https://repo.springsource.org/libs-milestone" }
}
ext {
springCloudVersion = '2021.0.9'
springCloudSkipperVersion = '2.11.5'
reactorVersion = 'Aluminium-SR3'
reactorNettyVersion = '0.6.6.RELEASE'
objenesisVersion = '2.1'
}
dependencies {
compile('org.springframework.cloud:spring-cloud-starter-skipper-server')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
mavenBom "org.springframework.cloud:spring-cloud-skipper-dependencies:${springCloudSkipperVersion}"
mavenBom "io.projectreactor:reactor-bom:${reactorVersion}"
}
dependencies {
// latest reactor bom is still using reactor-netty:0.6.3.RELEASE
// so we need to change it here because cf java client use
// dedicated netty version while they should have been using
// reactor boms assuming reactor boms would be up-to-date
dependency "io.projectreactor.ipc:reactor-netty:${reactorNettyVersion}"
// this is unfortunate mess with objenesis as there's versions 2.1 and 2.6
// in build path and nobody manages version and maven vs. gradle is different
dependency "org.objenesis:objenesis:${objenesisVersion}"
}
}