Release train documentation rendering
This commit is contained in:
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* Copyright 2013-2020 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.internal;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import org.springframework.util.FileSystemUtils;
|
||||
|
||||
import static org.springframework.cloud.internal.Logger.error;
|
||||
import static org.springframework.cloud.internal.Logger.info;
|
||||
|
||||
class ArtifactFetcher {
|
||||
|
||||
private static final int CONNECT_TIMEOUT = 5000;
|
||||
|
||||
private static final int READ_TIMEOUT = 5000;
|
||||
|
||||
private final File outputFolder;
|
||||
|
||||
private final String repoUrl;
|
||||
|
||||
ArtifactFetcher(File outputFolder, String repoUrl) {
|
||||
this.outputFolder = outputFolder;
|
||||
this.repoUrl = repoUrl;
|
||||
}
|
||||
|
||||
File unpackedDocs(Project project) {
|
||||
String projectName = project.name;
|
||||
String version = project.version;
|
||||
List<String> urls = urls(projectName, version);
|
||||
final File downloadedZipsFolder = new File(outputFolder, "downloaded-zips");
|
||||
downloadedZipsFolder.mkdirs();
|
||||
File outputZip = new File(downloadedZipsFolder, projectName + ".zip");
|
||||
for (String url : urls) {
|
||||
try {
|
||||
info(projectName + ": Fetching sources from [" + url
|
||||
+ "]. Please wait...");
|
||||
FileUtils.copyURLToFile(new URL(url), outputZip, CONNECT_TIMEOUT,
|
||||
READ_TIMEOUT);
|
||||
info(projectName + ": Successfully fetched a zip from [" + url + "] to ["
|
||||
+ outputZip + "]");
|
||||
break;
|
||||
}
|
||||
catch (IOException ex) {
|
||||
error(projectName + ": Failed to fetch a zip from [" + url + "]");
|
||||
}
|
||||
}
|
||||
if (!outputZip.exists()) {
|
||||
error(projectName
|
||||
+ ": Exception occurred while trying to download an artifact with name ["
|
||||
+ projectName + "] and version [" + version + "]");
|
||||
return null;
|
||||
}
|
||||
return unpackDocs(projectName, outputZip);
|
||||
}
|
||||
|
||||
private File unpackDocs(String projectName, File outputZip) {
|
||||
File unpackedDoc = unpackDoc(projectName, outputZip);
|
||||
info(projectName + ": Unpacked file to [" + unpackedDoc.getAbsolutePath() + "]");
|
||||
if (unpackedDoc.isDirectory()) {
|
||||
String[] subfolders = unpackedDoc.list();
|
||||
if (subfolders == null || subfolders.length != 1) {
|
||||
return unpackedDoc;
|
||||
}
|
||||
moveOneFolderUp(unpackedDoc, subfolders[0]);
|
||||
}
|
||||
return unpackedDoc;
|
||||
}
|
||||
|
||||
private void moveOneFolderUp(File unpackedDoc, String subfolder) {
|
||||
File onlySubfolder = new File(unpackedDoc, subfolder);
|
||||
try {
|
||||
FileSystemUtils.copyRecursively(onlySubfolder, unpackedDoc);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
FileSystemUtils.deleteRecursively(onlySubfolder);
|
||||
}
|
||||
|
||||
private List<String> urls(String projectName, String version) {
|
||||
ReleaseType releaseType = ReleaseType.fromVersion(version);
|
||||
String sourcesUrl = this.repoUrl + projectName + "/archive/";
|
||||
List<String> sourcesUrls = new LinkedList<>();
|
||||
if (releaseType == ReleaseType.SNAPSHOT) {
|
||||
// 2.0.0-SNAPSHOT or 2.0.0-BUILD-SNAPSHOT -> 2.0.x
|
||||
String[] splitVersion = version.split("\\.");
|
||||
sourcesUrls
|
||||
.add(sourcesUrl + splitVersion[0] + "." + splitVersion[1] + ".x.zip");
|
||||
// fallback
|
||||
sourcesUrls.add(sourcesUrl + "master.zip");
|
||||
}
|
||||
else {
|
||||
sourcesUrls.add(sourcesUrl + "v" + version + ".zip");
|
||||
}
|
||||
return sourcesUrls;
|
||||
}
|
||||
|
||||
private File unpackDoc(String artifactName, File zip) {
|
||||
File unzippedDocs = new File(outputFolder, artifactName);
|
||||
unzippedDocs.mkdirs();
|
||||
info(artifactName + ": Unpacking from [" + zip + "]");
|
||||
ZipCategory.unzipTo(zip, unzippedDocs);
|
||||
return unzippedDocs;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
enum ReleaseType {
|
||||
|
||||
SNAPSHOT, NON_SNAPSHOT;
|
||||
|
||||
static ReleaseType fromVersion(String version) {
|
||||
if (isSnapshot(version)) {
|
||||
return ReleaseType.SNAPSHOT;
|
||||
}
|
||||
return ReleaseType.NON_SNAPSHOT;
|
||||
}
|
||||
|
||||
private static boolean isSnapshot(String version) {
|
||||
return version.contains("SNAPSHOT");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright 2013-2020 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.internal;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
class ConfigurationPropertiesAggregator {
|
||||
|
||||
private static final List<String> wordsToIgnore = Arrays.asList("|===",
|
||||
"|Name | Default | Description");
|
||||
|
||||
List<ConfigurationProperty> mergedConfigurationProperties(Path unpackedDocs) {
|
||||
try {
|
||||
return Files.walk(unpackedDocs)
|
||||
.filter(path -> path.endsWith("_configprops.adoc")).flatMap(path -> {
|
||||
try {
|
||||
return Files.readAllLines(path).stream()
|
||||
.filter(s -> !StringUtils.isEmpty(s)
|
||||
&& !wordsToIgnore.contains(s))
|
||||
.map(s -> {
|
||||
// |foo|bar|baz -> foo|bar|baz -> split ->
|
||||
// foo,bar,baz
|
||||
String[] strings = s.substring(1).split("\\|");
|
||||
return new ConfigurationProperty(
|
||||
strings[0].trim(), strings[1].trim(),
|
||||
strings[2].trim());
|
||||
});
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}).sorted(Comparator.comparing(o -> o.name))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright 2013-2020 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.internal;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
class ConfigurationProperty {
|
||||
|
||||
final String name;
|
||||
|
||||
final String defaultValue;
|
||||
|
||||
final String description;
|
||||
|
||||
ConfigurationProperty(String name, String defaultValue, String description) {
|
||||
this.name = name;
|
||||
this.defaultValue = defaultValue;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ConfigurationProperty that = (ConfigurationProperty) o;
|
||||
return Objects.equals(name, that.name)
|
||||
&& Objects.equals(description, that.description)
|
||||
&& Objects.equals(defaultValue, that.defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(name, description, defaultValue);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public String getDefaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright 2013-2020 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.internal;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.maven.model.Model;
|
||||
|
||||
import static org.springframework.cloud.internal.Logger.info;
|
||||
|
||||
public class GenerateReleaseTrainDocs {
|
||||
|
||||
final ExecutorService service;
|
||||
|
||||
public static void main(String... args) {
|
||||
File bomPath = new File(args[0]);
|
||||
File starterParentPath = new File(args[1]);
|
||||
String repoUrl = args[2];
|
||||
File unzippedDocs = new File(args[3]);
|
||||
File generatedTrainDocs = new File(args[4]);
|
||||
new GenerateReleaseTrainDocs().generate(bomPath, starterParentPath, repoUrl,
|
||||
unzippedDocs, generatedTrainDocs);
|
||||
}
|
||||
|
||||
GenerateReleaseTrainDocs() {
|
||||
this.service = Executors.newFixedThreadPool(4);
|
||||
}
|
||||
|
||||
void generate(File bomPath, File starterParentPath, String repoUrl, File unzippedDocs,
|
||||
File generatedTrainDocs) {
|
||||
List<Project> projects = mavenPropertiesToDocsProjects(bomPath);
|
||||
info("Found the following projects [" + projects + "]");
|
||||
List<File> outputFolders = downloadSources(unzippedDocs, projects, repoUrl);
|
||||
projects.add(springBootVersion(starterParentPath));
|
||||
projects.sort(Comparator.comparing(o -> o.name));
|
||||
List<ConfigurationProperty> configurationProperties = mergeConfigurationProperties(
|
||||
unzippedDocs);
|
||||
File file = renderAsciidocTemplates(generatedTrainDocs, projects,
|
||||
configurationProperties);
|
||||
info("Rendered docs templates to [" + file + "]");
|
||||
new ResourcesCopier().copy(outputFolders, file);
|
||||
}
|
||||
|
||||
List<Project> mavenPropertiesToDocsProjects(File file) {
|
||||
Model model = PomReader.readPom(file);
|
||||
Properties properties = model.getProperties();
|
||||
return properties.entrySet().stream()
|
||||
.filter(e -> e.getKey().toString().endsWith(".version"))
|
||||
.map(e -> new Project(e.getKey().toString().replace(".version", ""),
|
||||
e.getValue().toString()))
|
||||
.collect(Collectors.toCollection(LinkedList::new));
|
||||
}
|
||||
|
||||
Project springBootVersion(File file) {
|
||||
Model model = PomReader.readPom(file);
|
||||
return new Project("spring-boot", model.getParent().getVersion());
|
||||
}
|
||||
|
||||
List<File> downloadSources(File outputFolder, List<Project> projects,
|
||||
String repoUrl) {
|
||||
ArtifactFetcher fetcher = new ArtifactFetcher(outputFolder, repoUrl);
|
||||
try {
|
||||
List<Future<File>> futures = new LinkedList<>();
|
||||
for (Project project : projects) {
|
||||
futures.add(service.submit(() -> fetcher.unpackedDocs(project)));
|
||||
}
|
||||
List<File> files = futures.stream().map(future -> {
|
||||
try {
|
||||
return future.get(5, TimeUnit.MINUTES);
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
info("Unpacked docs modules to the following directories [" + files + "]");
|
||||
return files;
|
||||
}
|
||||
finally {
|
||||
service.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
List<ConfigurationProperty> mergeConfigurationProperties(File outputFolderWithDocs) {
|
||||
ConfigurationPropertiesAggregator aggregator = new ConfigurationPropertiesAggregator();
|
||||
return aggregator.mergedConfigurationProperties(outputFolderWithDocs.toPath());
|
||||
}
|
||||
|
||||
File renderAsciidocTemplates(File generatedTrainDocs, List<Project> projects,
|
||||
List<ConfigurationProperty> configurationProperties) {
|
||||
TemplateGenerator templateGenerator = new TemplateGenerator(generatedTrainDocs);
|
||||
return templateGenerator.generate(projects, configurationProperties);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright 2013-2020 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.internal;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.github.jknack.handlebars.Handlebars;
|
||||
import com.github.jknack.handlebars.Template;
|
||||
import com.github.jknack.handlebars.helper.StringHelpers;
|
||||
import com.github.jknack.handlebars.io.ClassPathTemplateLoader;
|
||||
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
final class HandlebarsHelper {
|
||||
|
||||
private HandlebarsHelper() {
|
||||
throw new IllegalStateException("Can't instantiate a utility class");
|
||||
}
|
||||
|
||||
public static Template template(String templateName) {
|
||||
try {
|
||||
Handlebars handlebars = new Handlebars(
|
||||
new ClassPathTemplateLoader("/templates/spring-cloud/"));
|
||||
handlebars.registerHelper("replace", StringHelpers.replace);
|
||||
handlebars.registerHelper("capitalizeFirst", StringHelpers.capitalizeFirst);
|
||||
return handlebars.compile(templateName);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright 2013-2020 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.internal;
|
||||
|
||||
final class Logger {
|
||||
|
||||
private Logger() {
|
||||
|
||||
}
|
||||
|
||||
static void info(String text) {
|
||||
System.out.println(text);
|
||||
}
|
||||
|
||||
static void error(String text) {
|
||||
System.err.println(text);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright 2013-2020 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.internal;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.nio.file.Files;
|
||||
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
|
||||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
||||
|
||||
/**
|
||||
* Class that reads poms as {@link Model}.
|
||||
*
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
final class PomReader {
|
||||
|
||||
private PomReader() {
|
||||
throw new IllegalStateException("Shouldn't instantiate a utility class");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a parsed POM.
|
||||
* @param pom location to the pom
|
||||
* @return parsed model
|
||||
*/
|
||||
public static Model readPom(File pom) {
|
||||
if (!pom.exists()) {
|
||||
throw new IllegalStateException(
|
||||
"File [" + pom.getAbsolutePath() + "] not found");
|
||||
}
|
||||
String fileText = "";
|
||||
try (Reader reader = new FileReader(pom)) {
|
||||
if (pom.isFile()) {
|
||||
fileText = new String(Files.readAllBytes(pom.toPath()));
|
||||
}
|
||||
MavenXpp3Reader xpp3Reader = new MavenXpp3Reader();
|
||||
return xpp3Reader.read(reader);
|
||||
}
|
||||
catch (XmlPullParserException | IOException e) {
|
||||
if (pom.isFile() && fileText.length() == 0) {
|
||||
throw new IllegalStateException(
|
||||
"File [" + pom.getAbsolutePath() + "] is empty", e);
|
||||
}
|
||||
throw new IllegalStateException(
|
||||
"Failed to read file: " + pom.getAbsolutePath(), e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright 2013-2020 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.internal;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
class Project {
|
||||
|
||||
final String name;
|
||||
|
||||
final String version;
|
||||
|
||||
Project(String name, String version) {
|
||||
this.name = name;
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Project project = (Project) o;
|
||||
return Objects.equals(name, project.name)
|
||||
&& Objects.equals(version, project.version);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(name, version);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Project{" + "name='" + this.name + '\'' + ", version='" + this.version
|
||||
+ '\'' + '}';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2013-2020 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.internal;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.util.FileSystemUtils;
|
||||
|
||||
final class ResourcesCopier {
|
||||
|
||||
void copy(List<File> baseDirs, File output) {
|
||||
File images = new File(output, "images");
|
||||
baseDirs.forEach(input -> {
|
||||
try {
|
||||
File inputImages = new File(input, "images");
|
||||
if (!inputImages.exists()) {
|
||||
return;
|
||||
}
|
||||
Logger.info("Will copy [" + inputImages + "] files to [" + images + "]");
|
||||
FileSystemUtils.copyRecursively(inputImages, images);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright 2013-2020 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.internal;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.github.jknack.handlebars.Template;
|
||||
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
|
||||
import static org.springframework.cloud.internal.Logger.info;
|
||||
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
class TemplateGenerator {
|
||||
|
||||
final File outputFolder;
|
||||
|
||||
TemplateGenerator(File outputFolder) {
|
||||
this.outputFolder = outputFolder;
|
||||
this.outputFolder.mkdirs();
|
||||
}
|
||||
|
||||
File generate(List<Project> projects,
|
||||
List<ConfigurationProperty> configurationProperties) {
|
||||
PathMatchingResourcePatternResolver resourceLoader = new PathMatchingResourcePatternResolver();
|
||||
try {
|
||||
Resource[] resources = resourceLoader
|
||||
.getResources("templates/spring-cloud/*.hbs");
|
||||
List<TemplateProject> templateProjects = templateProjects(projects);
|
||||
for (Resource resource : resources) {
|
||||
File templateFile = resource.getFile();
|
||||
File outputFile = new File(outputFolder, renameTemplate(templateFile));
|
||||
Template template = template(templateFile.getName().replace(".hbs", ""));
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("projects", projects);
|
||||
map.put("springCloudProjects", templateProjects);
|
||||
map.put("properties", configurationProperties);
|
||||
String applied = template.apply(map);
|
||||
Files.write(outputFile.toPath(), applied.getBytes());
|
||||
info("Successfully rendered [" + outputFile.getAbsolutePath() + "]");
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
return outputFolder;
|
||||
}
|
||||
|
||||
private List<TemplateProject> templateProjects(List<Project> projects) {
|
||||
return projects.stream()
|
||||
.filter(project -> project.name.startsWith("spring-cloud-"))
|
||||
.map(project -> {
|
||||
if (project.name.contains("spring-cloud-task")) {
|
||||
return new TemplateProject(project.name, project.version,
|
||||
"{basedir}/" + project.name
|
||||
+ "/spring-cloud-task-docs/src/main/asciidoc/index.adoc[leveloffset=+1]");
|
||||
}
|
||||
return new TemplateProject(project.name, project.version,
|
||||
"{basedir}/" + project.name + "/docs/src/main/asciidoc/"
|
||||
+ project.name + ".adoc[leveloffset=+1]");
|
||||
}).collect(Collectors.toCollection(LinkedList::new));
|
||||
}
|
||||
|
||||
private String renameTemplate(File templateFile) {
|
||||
String templateName = templateFile.getName();
|
||||
if (templateName.endsWith("-pdf.hbs")) {
|
||||
return templateName.replace("-pdf.hbs", ".pdfadoc");
|
||||
}
|
||||
else if (templateName.endsWith("-single.hbs")) {
|
||||
return templateName.replace("-single.hbs", ".htmlsingleadoc");
|
||||
}
|
||||
return templateName.replace(".hbs", ".adoc");
|
||||
}
|
||||
|
||||
private Template template(String template) {
|
||||
return HandlebarsHelper.template(template);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright 2013-2020 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.internal;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
class TemplateProject {
|
||||
|
||||
final String name;
|
||||
|
||||
final String version;
|
||||
|
||||
final String include;
|
||||
|
||||
TemplateProject(String name, String version, String include) {
|
||||
this.name = name;
|
||||
this.version = version;
|
||||
this.include = include;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
TemplateProject that = (TemplateProject) o;
|
||||
return Objects.equals(name, that.name) && Objects.equals(version, that.version)
|
||||
&& Objects.equals(include, that.include);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(name, version, include);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public String getInclude() {
|
||||
return include;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright 2013-2020 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.internal;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
import org.springframework.util.StreamUtils;
|
||||
|
||||
/**
|
||||
* Based on
|
||||
* <a href="https://github.com/timyates/groovy-common-extensions">https://github.com/
|
||||
* timyates/groovy-common-extensions</a>.
|
||||
*
|
||||
* Category for {@link File} that adds a method that allows you to unzip a given file to a
|
||||
* specified location
|
||||
*
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
final class ZipCategory {
|
||||
|
||||
private ZipCategory() {
|
||||
throw new IllegalStateException("Can't instantiate a utility class");
|
||||
}
|
||||
|
||||
/**
|
||||
* Unzips this file. If the <tt>destination</tt> directory is not provided, it will
|
||||
* fall back to this file's parent directory.
|
||||
* @param self file
|
||||
* @param destination (optional), the destination directory where this file's content
|
||||
* will be unzipped to.
|
||||
* @return a {@link Collection} of unzipped {@link File} objects.
|
||||
*/
|
||||
static Collection<File> unzipTo(File self, File destination) {
|
||||
checkUnzipDestination(destination);
|
||||
// if destination directory is not given, we'll fall back to the parent directory
|
||||
// of 'self'
|
||||
if (destination == null) {
|
||||
destination = new File(self.getParent());
|
||||
}
|
||||
List<File> unzippedFiles = new ArrayList<>();
|
||||
try (InputStream fileInputStream = Files.newInputStream(self.toPath())) {
|
||||
try (ZipInputStream zipInput = new ZipInputStream(fileInputStream)) {
|
||||
for (ZipEntry entry = zipInput
|
||||
.getNextEntry(); entry != null; entry = zipInput.getNextEntry()) {
|
||||
if (!entry.isDirectory()) {
|
||||
final File file = new File(destination, entry.getName());
|
||||
if (file.getParentFile() != null) {
|
||||
file.getParentFile().mkdirs();
|
||||
}
|
||||
try (OutputStream output = Files.newOutputStream(file.toPath())) {
|
||||
StreamUtils.copy(zipInput, output);
|
||||
}
|
||||
unzippedFiles.add(file);
|
||||
}
|
||||
else {
|
||||
final File dir = new File(destination, entry.getName());
|
||||
dir.mkdirs();
|
||||
unzippedFiles.add(dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new IllegalStateException("Cannot unzip archive", e);
|
||||
}
|
||||
return unzippedFiles;
|
||||
}
|
||||
|
||||
private static void checkUnzipDestination(File file) {
|
||||
if (file != null && !file.isDirectory()) {
|
||||
throw new IllegalArgumentException("'destination' has to be a directory.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
:doctype: book
|
||||
:idprefix:
|
||||
:idseparator: -
|
||||
:toc: left
|
||||
:toclevels: 4
|
||||
:tabsize: 4
|
||||
:numbered:
|
||||
:sectanchors:
|
||||
:sectnums:
|
||||
:icons: font
|
||||
:hide-uri-scheme:
|
||||
:docinfo: shared,private
|
||||
|
||||
:project-full-name: Spring Cloud
|
||||
:project-name: spring-cloud
|
||||
@@ -0,0 +1,2 @@
|
||||
{{#each projects}}:{{name}}-version: {{version}}
|
||||
{{/each}}
|
||||
@@ -0,0 +1,2 @@
|
||||
{{#each springCloudProjects}} https://docs.spring.io/{{name}}/docs/{{version}}/reference/html/[{{name}}] :: {{name}} Reference Documentation, version {{version}}
|
||||
{{/each}}
|
||||
@@ -0,0 +1,2 @@
|
||||
{{#each projects}} |{{name}}|{{version}}
|
||||
{{/each}}
|
||||
@@ -0,0 +1,7 @@
|
||||
|===
|
||||
|Name | Default | Description
|
||||
|
||||
{{#each properties}} |{{name}} | {{defaultValue}} | {{description}}
|
||||
{{/each}}
|
||||
|
||||
|===
|
||||
@@ -0,0 +1,38 @@
|
||||
[[documentation]]
|
||||
= Spring Cloud Documentation
|
||||
include::_attributes.adoc[]
|
||||
|
||||
:docs-url: https://docs.spring.io/spring-cloud/docs/{spring-cloud-version}
|
||||
|
||||
This section provides a brief overview of Spring Cloud reference documentation. It serves
|
||||
as a map for the rest of the document.
|
||||
|
||||
|
||||
|
||||
[[documentation-about]]
|
||||
== About the Documentation
|
||||
|
||||
The {project-full-name} reference guide is available as
|
||||
|
||||
* {docs-url}/reference/html[Multi-page HTML]
|
||||
* {docs-url}/reference/htmlsingle[Single-page HTML]
|
||||
* {docs-url}/reference/pdf/{project-name}.pdf[PDF]
|
||||
|
||||
Copies of this document may be made for your own use and for distribution to others,
|
||||
provided that you do not charge any fee for such copies and further provided that each
|
||||
copy contains this Copyright Notice, whether distributed in print or electronically.
|
||||
|
||||
|
||||
|
||||
[[documentation-getting-help]]
|
||||
== Getting Help
|
||||
If you have trouble with {project-full-name}, we would like to help.
|
||||
|
||||
* Learn the {project-full-name} basics. If you are
|
||||
starting out with {project-full-name}, try one of the https://spring.io/guides[guides].
|
||||
* Ask a question. We monitor https://stackoverflow.com[stackoverflow.com] for questions
|
||||
tagged with https://stackoverflow.com/tags/spring-cloud[`spring-cloud`].
|
||||
* Chat with us at https://gitter.im/spring-cloud/spring-cloud[{project-full-name} Gitter]
|
||||
|
||||
NOTE: All of {project-full-name} is open source, including the documentation. If you find
|
||||
problems with the docs or if you want to improve them, please get involved.
|
||||
@@ -0,0 +1,11 @@
|
||||
[legal]
|
||||
= Legal
|
||||
|
||||
{spring-cloud-version}
|
||||
|
||||
Copyright © 2012-2020
|
||||
|
||||
Copies of this document may be made for your own use and for distribution to
|
||||
others, provided that you do not charge any fee for such copies and further
|
||||
provided that each copy contains this Copyright Notice, whether distributed in
|
||||
print or electronically.
|
||||
@@ -0,0 +1,57 @@
|
||||
= Spring Cloud
|
||||
|
||||
include::_attributes.adoc[]
|
||||
include::_spring-cloud-attributes.adoc[]
|
||||
|
||||
:basedir: {project-root}
|
||||
:project-full-name: Spring Cloud
|
||||
:project-name: spring-cloud
|
||||
|
||||
Spring Cloud provides tools for developers to quickly build some of
|
||||
the common patterns in distributed systems (e.g. configuration
|
||||
management, service discovery, circuit breakers, intelligent routing,
|
||||
micro-proxy, control bus). Coordination of
|
||||
distributed systems leads to boiler plate patterns, and using Spring
|
||||
Cloud developers can quickly stand up services and applications that
|
||||
implement those patterns. They will work well in any distributed
|
||||
environment, including the developer's own laptop, bare metal data
|
||||
centres, and managed platforms such as Cloud Foundry.
|
||||
|
||||
Release Train Version: *{spring-cloud-version}*
|
||||
|
||||
Supported Boot Version: *{spring-boot-version}*
|
||||
|
||||
== Features
|
||||
|
||||
Spring Cloud focuses on providing good out of box experience for typical use cases
|
||||
and extensibility mechanism to cover others.
|
||||
|
||||
* Distributed/versioned configuration
|
||||
* Service registration and discovery
|
||||
* Routing
|
||||
* Service-to-service calls
|
||||
* Load balancing
|
||||
* Circuit Breakers
|
||||
* Distributed messaging
|
||||
|
||||
[[cloud-documentation-versions]]
|
||||
== Release Train Versions
|
||||
|
||||
.Release Train Project Versions
|
||||
|===
|
||||
|Project Name| Project Version
|
||||
|
||||
include::_spring-cloud-versions.adoc[]
|
||||
|===
|
||||
|
||||
{{=<% %>=}}
|
||||
<%#each springCloudProjects%>
|
||||
:project-root: {basedir}/<%name%>
|
||||
:project-version: {<%name%>-version}
|
||||
include::<%include%>
|
||||
<%/each%>
|
||||
<%={{ }}=%>
|
||||
|
||||
= Appendix: Compendium of Configuration Properties
|
||||
|
||||
include::configprops.adoc[leveloffset=+1]
|
||||
@@ -0,0 +1,57 @@
|
||||
= Spring Cloud
|
||||
|
||||
include::_attributes.adoc[]
|
||||
include::_spring-cloud-attributes.adoc[]
|
||||
|
||||
:basedir: {project-root}
|
||||
:project-full-name: Spring Cloud
|
||||
:project-name: spring-cloud
|
||||
|
||||
Spring Cloud provides tools for developers to quickly build some of
|
||||
the common patterns in distributed systems (e.g. configuration
|
||||
management, service discovery, circuit breakers, intelligent routing,
|
||||
micro-proxy, control bus). Coordination of
|
||||
distributed systems leads to boiler plate patterns, and using Spring
|
||||
Cloud developers can quickly stand up services and applications that
|
||||
implement those patterns. They will work well in any distributed
|
||||
environment, including the developer's own laptop, bare metal data
|
||||
centres, and managed platforms such as Cloud Foundry.
|
||||
|
||||
Release Train Version: *{spring-cloud-version}*
|
||||
|
||||
Supported Boot Version: *{spring-boot-version}*
|
||||
|
||||
== Features
|
||||
|
||||
Spring Cloud focuses on providing good out of box experience for typical use cases
|
||||
and extensibility mechanism to cover others.
|
||||
|
||||
* Distributed/versioned configuration
|
||||
* Service registration and discovery
|
||||
* Routing
|
||||
* Service-to-service calls
|
||||
* Load balancing
|
||||
* Circuit Breakers
|
||||
* Distributed messaging
|
||||
|
||||
[[cloud-documentation-versions]]
|
||||
== Release Train Versions
|
||||
|
||||
.Release Train Project Versions
|
||||
|===
|
||||
|Project Name| Project Version
|
||||
|
||||
include::_spring-cloud-versions.adoc[]
|
||||
|===
|
||||
|
||||
{{=<% %>=}}
|
||||
<%#each springCloudProjects%>
|
||||
:project-root: {basedir}/<%name%>
|
||||
:project-version: {<%name%>-version}
|
||||
include::<%include%>
|
||||
<%/each%>
|
||||
<%={{ }}=%>
|
||||
|
||||
= Appendix: Compendium of Configuration Properties
|
||||
|
||||
include::configprops.adoc[leveloffset=+1]
|
||||
@@ -0,0 +1,44 @@
|
||||
= Spring Cloud
|
||||
|
||||
include::_attributes.adoc[]
|
||||
include::_spring-cloud-attributes.adoc[]
|
||||
|
||||
:basedir: {project-root}
|
||||
|
||||
Spring Cloud provides tools for developers to quickly build some of
|
||||
the common patterns in distributed systems (e.g. configuration
|
||||
management, service discovery, circuit breakers, intelligent routing,
|
||||
micro-proxy, control bus). Coordination of
|
||||
distributed systems leads to boiler plate patterns, and using Spring
|
||||
Cloud developers can quickly stand up services and applications that
|
||||
implement those patterns. They will work well in any distributed
|
||||
environment, including the developer's own laptop, bare metal data
|
||||
centres, and managed platforms such as Cloud Foundry.
|
||||
|
||||
Release Train Version: *{spring-cloud-version}*
|
||||
|
||||
Supported Boot Version: *{spring-boot-version}*
|
||||
|
||||
== Features
|
||||
|
||||
Spring Cloud focuses on providing good out of box experience for typical use cases
|
||||
and extensibility mechanism to cover others.
|
||||
|
||||
* Distributed/versioned configuration
|
||||
* Service registration and discovery
|
||||
* Routing
|
||||
* Service-to-service calls
|
||||
* Load balancing
|
||||
* Circuit Breakers
|
||||
* Distributed messaging
|
||||
|
||||
The reference documentation consists of the following sections:
|
||||
|
||||
[horizontal]
|
||||
<<legal.adoc#legal-information,Legal>> :: Legal information.
|
||||
<<documentation-overview.adoc#documentation,Documentation Overview>> :: About the Documentation, Getting Help, First Steps, and more.
|
||||
include::_spring-cloud-links.adoc[]
|
||||
|
||||
= Appendix: Compendium of Configuration Properties
|
||||
|
||||
link:configprops.html[Spring Cloud configuration properties]
|
||||
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* Copyright 2013-2020 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.internal;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.file.Files;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.util.FileSystemUtils;
|
||||
|
||||
public class GenerateReleaseTrainDocsTests {
|
||||
|
||||
@Test
|
||||
void should_return_a_list_of_docs_modules_to_download() throws URISyntaxException {
|
||||
File testPom = new File(
|
||||
GenerateReleaseTrainDocsTests.class.getResource("/test/pom.xml").toURI());
|
||||
|
||||
List<Project> projects = new GenerateReleaseTrainDocs()
|
||||
.mavenPropertiesToDocsProjects(testPom);
|
||||
|
||||
BDDAssertions.then(projects).extracting("name").containsOnly("spring-cloud-bus",
|
||||
"spring-cloud-build", "spring-cloud-cloudfoundry", "spring-cloud-commons",
|
||||
"spring-cloud-circuitbreaker", "spring-cloud-config",
|
||||
"spring-cloud-consul", "spring-cloud-contract", "spring-cloud-function",
|
||||
"spring-cloud-gateway", "spring-cloud-kubernetes", "spring-cloud-netflix",
|
||||
"spring-cloud-openfeign", "spring-cloud-security", "spring-cloud-sleuth",
|
||||
"spring-cloud-stream", "spring-cloud-task", "spring-cloud-vault",
|
||||
"spring-cloud-zookeeper", "spring-cloud-cli");
|
||||
BDDAssertions.then(projects)
|
||||
.contains(new Project("spring-cloud-bus", "1.2.3-SNAPSHOT"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void should_unpack_starters_docs() throws URISyntaxException {
|
||||
File testPom = new File(GenerateReleaseTrainDocsTests.class
|
||||
.getResource("/test/sleuth-only.xml").toURI());
|
||||
File unzippedDocs = new File("target/test-unpacked-docs/");
|
||||
List<Project> projects = new GenerateReleaseTrainDocs()
|
||||
.mavenPropertiesToDocsProjects(testPom);
|
||||
|
||||
new GenerateReleaseTrainDocs().downloadSources(unzippedDocs, projects,
|
||||
"https://github.com/spring-cloud/");
|
||||
|
||||
BDDAssertions.then(unzippedDocs).isNotEmptyDirectory();
|
||||
}
|
||||
|
||||
@Test
|
||||
void should_generate_adocs_from_templates() {
|
||||
File file = new File("target/test-train-docs");
|
||||
FileSystemUtils.deleteRecursively(file);
|
||||
List<Project> projects = Arrays.asList(new Project("spring-cloud-foo", "1.0.0"),
|
||||
new Project("spring-cloud-bar", "2.0.0"),
|
||||
new Project("spring-boot", "3.0.0"),
|
||||
new Project("spring-cloud", "4.0.0"));
|
||||
List<ConfigurationProperty> configurationProperties = Arrays.asList(
|
||||
new ConfigurationProperty("first", "firstDefault", "firstDescription"),
|
||||
new ConfigurationProperty("second", "secondDefault",
|
||||
"secondDescription"));
|
||||
|
||||
File outputFolder = new TemplateGenerator(file).generate(projects,
|
||||
configurationProperties);
|
||||
|
||||
BDDAssertions.then(outputFolder).isNotEmptyDirectory();
|
||||
}
|
||||
|
||||
@Test
|
||||
void should_generate_adocs_from_spring_cloud_sleuth_docs()
|
||||
throws URISyntaxException, IOException {
|
||||
File generatedAdocs = new File("target/test-train-sleuth-docs");
|
||||
FileSystemUtils.deleteRecursively(generatedAdocs);
|
||||
File testPom = new File(GenerateReleaseTrainDocsTests.class
|
||||
.getResource("/test/sleuth-only.xml").toURI());
|
||||
File starterPom = new File(GenerateReleaseTrainDocsTests.class
|
||||
.getResource("/test/starter-pom.xml").toURI());
|
||||
File unzippedDocs = new File("target/test-unpacked-sleuth-docs/");
|
||||
|
||||
GenerateReleaseTrainDocs.main(testPom.getAbsolutePath(),
|
||||
starterPom.getAbsolutePath(), "https://github.com/spring-cloud/",
|
||||
unzippedDocs.getAbsolutePath(), generatedAdocs.getAbsolutePath());
|
||||
|
||||
BDDAssertions.then(generatedAdocs).isNotEmptyDirectory();
|
||||
BDDAssertions.then(configProps(generatedAdocs)).contains(
|
||||
"|spring.sleuth.async.configurer.enabled | true | Enable default AsyncConfigurer.");
|
||||
}
|
||||
|
||||
private String configProps(File file) throws IOException {
|
||||
return new String(
|
||||
Files.readAllBytes(new File(file, "configprops.adoc").toPath()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright 2013-2020 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.internal;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.junit.jupiter.api.Assumptions;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
public class TestThatGeneratesTheFinalReleaseTrainDocumentationTests {
|
||||
|
||||
/**
|
||||
* FOR SOME REASON I CAN'T RUN MAIN CLASS FROM MAVEN AS A WORKAOUND WE WILL RUN THIS
|
||||
* TEST TO GENERATE THE DOCS
|
||||
*/
|
||||
@Test
|
||||
@Disabled
|
||||
void should_generate_adocs_with_values_from_system_property() {
|
||||
// System property needs to be passed
|
||||
Assumptions.assumeTrue(StringUtils.hasText(System.getProperty("bomPath")));
|
||||
|
||||
String bomPath = System.getProperty("bomPath");
|
||||
String starterParentPath = System.getProperty("starterParentPath");
|
||||
String repoUrl = System.getProperty("repoUrl");
|
||||
String unzippedDocs = System.getProperty("unzippedDocs");
|
||||
String generatedTrainDocs = System.getProperty("generatedTrainDocs");
|
||||
|
||||
GenerateReleaseTrainDocs.main(bomPath, starterParentPath, repoUrl, unzippedDocs,
|
||||
generatedTrainDocs);
|
||||
|
||||
BDDAssertions.then(new File(generatedTrainDocs)).isNotEmptyDirectory();
|
||||
}
|
||||
|
||||
}
|
||||
25
train-docs/src/test/resources/logback.xml
Normal file
25
train-docs/src/test/resources/logback.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<!--
|
||||
~ Copyright 2013-2020 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.
|
||||
-->
|
||||
|
||||
<configuration>
|
||||
|
||||
<include resource="org/springframework/boot/logging/logback/base.xml"/>
|
||||
<logger name="org.springframework.cloud" level="DEBUG"/>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</root>
|
||||
</configuration>
|
||||
255
train-docs/src/test/resources/test/pom.xml
Normal file
255
train-docs/src/test/resources/test/pom.xml
Normal file
@@ -0,0 +1,255 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
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>
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-dependencies-parent</artifactId>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-dependencies</artifactId>
|
||||
<version>2020.0.0-SNAPSHOT</version>
|
||||
<name>spring-cloud-dependencies</name>
|
||||
<description>Spring Cloud Dependencies</description>
|
||||
<packaging>pom</packaging>
|
||||
<properties>
|
||||
<main.basedir>${basedir}/../..</main.basedir>
|
||||
<spring-cloud-bus.version>1.2.3-SNAPSHOT</spring-cloud-bus.version>
|
||||
<spring-cloud-build.version>3.0.0-SNAPSHOT</spring-cloud-build.version>
|
||||
<spring-cloud-cloudfoundry.version>3.0.0-SNAPSHOT</spring-cloud-cloudfoundry.version>
|
||||
<spring-cloud-commons.version>3.0.0-SNAPSHOT</spring-cloud-commons.version>
|
||||
<spring-cloud-circuitbreaker.version>2.0.0-SNAPSHOT</spring-cloud-circuitbreaker.version>
|
||||
<spring-cloud-config.version>3.0.0-SNAPSHOT</spring-cloud-config.version>
|
||||
<spring-cloud-consul.version>3.0.0-SNAPSHOT</spring-cloud-consul.version>
|
||||
<spring-cloud-contract.version>3.0.0-SNAPSHOT</spring-cloud-contract.version>
|
||||
<spring-cloud-function.version>3.1.0-SNAPSHOT</spring-cloud-function.version>
|
||||
<spring-cloud-gateway.version>3.0.0-SNAPSHOT</spring-cloud-gateway.version>
|
||||
<spring-cloud-kubernetes.version>2.0.0-SNAPSHOT</spring-cloud-kubernetes.version>
|
||||
<spring-cloud-netflix.version>3.0.0-SNAPSHOT</spring-cloud-netflix.version>
|
||||
<spring-cloud-openfeign.version>3.0.0-SNAPSHOT</spring-cloud-openfeign.version>
|
||||
<spring-cloud-security.version>3.0.0-SNAPSHOT</spring-cloud-security.version>
|
||||
<spring-cloud-sleuth.version>3.0.0-SNAPSHOT</spring-cloud-sleuth.version>
|
||||
<spring-cloud-stream.version>3.1.0-SNAPSHOT</spring-cloud-stream.version>
|
||||
<spring-cloud-task.version>2.3.0-SNAPSHOT</spring-cloud-task.version>
|
||||
<spring-cloud-vault.version>3.0.0-SNAPSHOT</spring-cloud-vault.version>
|
||||
<spring-cloud-zookeeper.version>3.0.0-SNAPSHOT</spring-cloud-zookeeper.version>
|
||||
<spring-cloud-cli.version>3.0.0-SNAPSHOT</spring-cloud-cli.version>
|
||||
</properties>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<!-- bom dependencies at the bottom so they can be overridden above -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-commons-dependencies</artifactId>
|
||||
<version>${spring-cloud-commons.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-netflix-dependencies</artifactId>
|
||||
<version>${spring-cloud-netflix.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-stream-dependencies</artifactId>
|
||||
<version>${spring-cloud-stream.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-task-dependencies</artifactId>
|
||||
<version>${spring-cloud-task.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-circuitbreaker-dependencies</artifactId>
|
||||
<version>${spring-cloud-circuitbreaker.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-config-dependencies</artifactId>
|
||||
<version>${spring-cloud-config.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-function-dependencies</artifactId>
|
||||
<version>${spring-cloud-function.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-gateway-dependencies</artifactId>
|
||||
<version>${spring-cloud-gateway.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-consul-dependencies</artifactId>
|
||||
<version>${spring-cloud-consul.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-sleuth-dependencies</artifactId>
|
||||
<version>${spring-cloud-sleuth.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-vault-dependencies</artifactId>
|
||||
<version>${spring-cloud-vault.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-zookeeper-dependencies</artifactId>
|
||||
<version>${spring-cloud-zookeeper.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-security-dependencies</artifactId>
|
||||
<version>${spring-cloud-security.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-cloudfoundry-dependencies</artifactId>
|
||||
<version>${spring-cloud-cloudfoundry.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-bus-dependencies</artifactId>
|
||||
<version>${spring-cloud-bus.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-dependencies</artifactId>
|
||||
<version>${spring-cloud-contract.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-openfeign-dependencies</artifactId>
|
||||
<version>${spring-cloud-openfeign.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-kubernetes-dependencies</artifactId>
|
||||
<version>${spring-cloud-kubernetes.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>flatten-maven-plugin</artifactId>
|
||||
<inherited>false</inherited>
|
||||
<executions>
|
||||
<execution>
|
||||
<!-- Flatten and simplify our own POM for install/deploy -->
|
||||
<id>flatten</id>
|
||||
<phase>process-resources</phase>
|
||||
<goals>
|
||||
<goal>flatten</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<updatePomFile>true</updatePomFile>
|
||||
<flattenMode>bom</flattenMode>
|
||||
<pomElements>
|
||||
<parent>expand</parent>
|
||||
<pluginManagement>keep</pluginManagement>
|
||||
<properties>keep</properties>
|
||||
<repositories>remove</repositories>
|
||||
</pomElements>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>flatten-clean</id>
|
||||
<phase>clean</phase>
|
||||
<goals>
|
||||
<goal>clean</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>spring</id>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spring-snapshots</id>
|
||||
<name>Spring Snapshots</name>
|
||||
<url>https://repo.spring.io/libs-snapshot-local</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spring-milestones</id>
|
||||
<name>Spring Milestones</name>
|
||||
<url>https://repo.spring.io/libs-milestone-local</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spring-releases</id>
|
||||
<name>Spring Releases</name>
|
||||
<url>https://repo.spring.io/release</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>spring-snapshots</id>
|
||||
<name>Spring Snapshots</name>
|
||||
<url>https://repo.spring.io/libs-snapshot-local</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
<pluginRepository>
|
||||
<id>spring-milestones</id>
|
||||
<name>Spring Milestones</name>
|
||||
<url>https://repo.spring.io/libs-milestone-local</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
236
train-docs/src/test/resources/test/sleuth-only.xml
Normal file
236
train-docs/src/test/resources/test/sleuth-only.xml
Normal file
@@ -0,0 +1,236 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
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>
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-dependencies-parent</artifactId>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-dependencies</artifactId>
|
||||
<version>2020.0.0-SNAPSHOT</version>
|
||||
<name>spring-cloud-dependencies</name>
|
||||
<description>Spring Cloud Dependencies</description>
|
||||
<packaging>pom</packaging>
|
||||
<properties>
|
||||
<main.basedir>${basedir}/../..</main.basedir>
|
||||
<spring-cloud-sleuth.version>3.0.0-SNAPSHOT</spring-cloud-sleuth.version>
|
||||
</properties>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<!-- bom dependencies at the bottom so they can be overridden above -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-commons-dependencies</artifactId>
|
||||
<version>${spring-cloud-commons.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-netflix-dependencies</artifactId>
|
||||
<version>${spring-cloud-netflix.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-stream-dependencies</artifactId>
|
||||
<version>${spring-cloud-stream.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-task-dependencies</artifactId>
|
||||
<version>${spring-cloud-task.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-circuitbreaker-dependencies</artifactId>
|
||||
<version>${spring-cloud-circuitbreaker.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-config-dependencies</artifactId>
|
||||
<version>${spring-cloud-config.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-function-dependencies</artifactId>
|
||||
<version>${spring-cloud-function.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-gateway-dependencies</artifactId>
|
||||
<version>${spring-cloud-gateway.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-consul-dependencies</artifactId>
|
||||
<version>${spring-cloud-consul.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-sleuth-dependencies</artifactId>
|
||||
<version>${spring-cloud-sleuth.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-vault-dependencies</artifactId>
|
||||
<version>${spring-cloud-vault.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-zookeeper-dependencies</artifactId>
|
||||
<version>${spring-cloud-zookeeper.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-security-dependencies</artifactId>
|
||||
<version>${spring-cloud-security.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-cloudfoundry-dependencies</artifactId>
|
||||
<version>${spring-cloud-cloudfoundry.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-bus-dependencies</artifactId>
|
||||
<version>${spring-cloud-bus.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-contract-dependencies</artifactId>
|
||||
<version>${spring-cloud-contract.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-openfeign-dependencies</artifactId>
|
||||
<version>${spring-cloud-openfeign.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-kubernetes-dependencies</artifactId>
|
||||
<version>${spring-cloud-kubernetes.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>flatten-maven-plugin</artifactId>
|
||||
<inherited>false</inherited>
|
||||
<executions>
|
||||
<execution>
|
||||
<!-- Flatten and simplify our own POM for install/deploy -->
|
||||
<id>flatten</id>
|
||||
<phase>process-resources</phase>
|
||||
<goals>
|
||||
<goal>flatten</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<updatePomFile>true</updatePomFile>
|
||||
<flattenMode>bom</flattenMode>
|
||||
<pomElements>
|
||||
<parent>expand</parent>
|
||||
<pluginManagement>keep</pluginManagement>
|
||||
<properties>keep</properties>
|
||||
<repositories>remove</repositories>
|
||||
</pomElements>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>flatten-clean</id>
|
||||
<phase>clean</phase>
|
||||
<goals>
|
||||
<goal>clean</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>spring</id>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spring-snapshots</id>
|
||||
<name>Spring Snapshots</name>
|
||||
<url>https://repo.spring.io/libs-snapshot-local</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spring-milestones</id>
|
||||
<name>Spring Milestones</name>
|
||||
<url>https://repo.spring.io/libs-milestone-local</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spring-releases</id>
|
||||
<name>Spring Releases</name>
|
||||
<url>https://repo.spring.io/release</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>spring-snapshots</id>
|
||||
<name>Spring Snapshots</name>
|
||||
<url>https://repo.spring.io/libs-snapshot-local</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
<pluginRepository>
|
||||
<id>spring-milestones</id>
|
||||
<name>Spring Milestones</name>
|
||||
<url>https://repo.spring.io/libs-milestone-local</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
156
train-docs/src/test/resources/test/starter-pom.xml
Normal file
156
train-docs/src/test/resources/test/starter-pom.xml
Normal file
@@ -0,0 +1,156 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
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>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.4.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-parent</artifactId>
|
||||
<version>2020.0.0-SNAPSHOT</version>
|
||||
<name>spring-cloud-starter-parent</name>
|
||||
<description>Spring Cloud Starter Parent</description>
|
||||
<packaging>pom</packaging>
|
||||
<url>https://projects.spring.io/spring-cloud</url>
|
||||
<organization>
|
||||
<name>Pivotal Software, Inc.</name>
|
||||
<url>https://www.spring.io</url>
|
||||
</organization>
|
||||
<properties>
|
||||
<main.basedir>${basedir}/../..</main.basedir>
|
||||
<spring-cloud.version>2020.0.0-SNAPSHOT</spring-cloud.version>
|
||||
</properties>
|
||||
<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>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
<distributionManagement>
|
||||
<downloadUrl>https://github.com/spring-cloud</downloadUrl>
|
||||
<site>
|
||||
<id>spring-docs</id>
|
||||
<url>
|
||||
scp://static.springframework.org/var/www/domains/springframework.org/static/htdocs/spring-cloud/docs/${project.artifactId}/${project.version}
|
||||
</url>
|
||||
</site>
|
||||
<repository>
|
||||
<id>repo.spring.io</id>
|
||||
<name>Spring Release Repository</name>
|
||||
<url>https://repo.spring.io/libs-release-local</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>repo.spring.io</id>
|
||||
<name>Spring Snapshot Repository</name>
|
||||
<url>https://repo.spring.io/libs-snapshot-local</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>spring</id>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spring-snapshots</id>
|
||||
<name>Spring Snapshots</name>
|
||||
<url>https://repo.spring.io/libs-snapshot-local</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spring-milestones</id>
|
||||
<name>Spring Milestones</name>
|
||||
<url>https://repo.spring.io/libs-milestone-local</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spring-releases</id>
|
||||
<name>Spring Releases</name>
|
||||
<url>https://repo.spring.io/release</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>spring-snapshots</id>
|
||||
<name>Spring Snapshots</name>
|
||||
<url>https://repo.spring.io/libs-snapshot-local</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
<pluginRepository>
|
||||
<id>spring-milestones</id>
|
||||
<name>Spring Milestones</name>
|
||||
<url>https://repo.spring.io/libs-milestone-local</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>milestone</id>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>repo.spring.io</id>
|
||||
<name>Spring Milestone Repository</name>
|
||||
<url>https://repo.spring.io/libs-milestone-local</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>bintray</id>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>bintray</id>
|
||||
<name>Jcenter Repository</name>
|
||||
<url>https://api.bintray.com/maven/spring/jars/org.springframework.cloud:${bintray.package}</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>central</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>sonatype-nexus-snapshots</id>
|
||||
<name>Sonatype Nexus Snapshots</name>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
|
||||
</snapshotRepository>
|
||||
<repository>
|
||||
<id>sonatype-nexus-staging</id>
|
||||
<name>Nexus Release Repository</name>
|
||||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
Reference in New Issue
Block a user