Appendices

Having trouble with Spring Cloud Skipper, We’d like to help!spring-doc.cn

Appendix A: Building

To build the source, you need to install JDK 1.8.spring-doc.cn

The build uses the Maven wrapper so that you do not have to install a specific version of Maven.spring-doc.cn

The main build command isspring-doc.cn

$ ./mvnw clean install

To create the executables and avoid running the tests and generating JavaDocs, use the following command:spring-doc.cn

$ ./mvnw clean package -DskipTests -Dmaven.javadoc.skip=true
You can also install Maven (>=3.3.3) yourself and run the mvn command in place of ./mvnw in the examples. If you do so, you also might need to add -P spring if your local Maven settings do not contain repository declarations for spring pre-release artifacts.
You might need to increase the amount of memory available to Maven by setting a MAVEN_OPTS environment variable with a value like -Xmx512m -XX:MaxPermSize=128m. We try to cover this in the .mvn configuration, so, if you find you have to increase memory to make a build succeed, please raise a ticket to get the settings added to source control.

A.1. Documentation

To generate only the REST Docs documentation, use the following command:spring-doc.cn

$ ./mvnw test -pl spring-cloud-skipper-server-core -Dtest=*Documentation*

To build the only the Asciidoctor documentation, use the following command:spring-doc.cn

$ ./mvnw package -DskipTests -Pfull -pl spring-cloud-skipper-docs

A.2. Custom Server Build

This chapter contains instructions how to create a custom server build and should cause exactly same packaged uber-jar compared to one from a Skipper build itself.spring-doc.cn

It is required to follow same Spring Boot main class structure used in Skipper itself. Example of it is shown below:spring-doc.cn

package com.example.customskipperserver;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.actuate.autoconfigure.ManagementWebSecurityAutoConfiguration;
import org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration;
import org.springframework.boot.autoconfigure.session.SessionAutoConfiguration;
import org.springframework.cloud.deployer.spi.cloudfoundry.CloudFoundryDeployerAutoConfiguration;
import org.springframework.cloud.deployer.spi.kubernetes.KubernetesAutoConfiguration;
import org.springframework.cloud.deployer.spi.local.LocalDeployerAutoConfiguration;
import org.springframework.cloud.skipper.server.EnableSkipperServer;

@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);
	}
}

Working build file for Maven would look like something shown below:spring-doc.cn

<?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>

Working build file for Gradle would look like something shown below:spring-doc.cn

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}"
	}
}

A.3. Importing into eclipse

You can generate Eclipse project metadata by using the following command:spring-doc.cn

$ ./mvnw eclipse:eclipse

In Eclipse, the generated projects can be imported by selecting Import existing projects from the File menu.spring-doc.cn