├── .springformat
├── .mvn
├── maven.config
├── wrapper
│ ├── maven-wrapper.jar
│ ├── maven-wrapper.properties
│ └── MavenWrapperDownloader.java
└── jvm.config
├── docs
├── src
│ ├── main
│ │ ├── .gitignore
│ │ ├── antora
│ │ │ └── resources
│ │ │ │ └── antora-resources
│ │ │ │ └── antora.yml
│ │ ├── java
│ │ │ └── org
│ │ │ │ └── springframework
│ │ │ │ └── cloud
│ │ │ │ └── internal
│ │ │ │ ├── asciidoctor
│ │ │ │ ├── ReadmeMain.java
│ │ │ │ └── CoalescerPreprocessor.java
│ │ │ │ └── Main.java
│ │ └── asciidoc
│ │ │ └── README.adoc
│ └── test
│ │ ├── resources
│ │ ├── included.adoc
│ │ ├── test.adoc
│ │ ├── not-matching-name.json
│ │ ├── with-cloud-in-name.json
│ │ └── README.adoc
│ │ └── java
│ │ └── org
│ │ └── springframework
│ │ └── cloud
│ │ └── internal
│ │ ├── MainTests.java
│ │ ├── asciidoctor
│ │ └── ReadmeMainTests.java
│ │ └── GeneratorTests.java
├── modules
│ └── ROOT
│ │ ├── nav.adoc
│ │ ├── pages
│ │ ├── building.adoc
│ │ ├── contributing.adoc
│ │ └── index.adoc
│ │ ├── assets
│ │ └── images
│ │ │ ├── intellij-checkstyle.png
│ │ │ ├── intellij-code-style.png
│ │ │ └── intellij-inspections.png
│ │ └── partials
│ │ ├── contributing-docs.adoc
│ │ ├── code-of-conduct.adoc
│ │ ├── building.adoc
│ │ └── contributing.adoc
├── package.json
├── antora.yml
├── antora-playbook.yml
└── pom.xml
├── .github
├── dco.yml
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
├── ISSUE_TEMPLATE.md
├── workflows
│ ├── maven.yml
│ ├── deploy.yml
│ └── deploy-docs.yml
├── CONTRIBUTING.md
└── dependabot.yml
├── scripts
├── build.sh
└── sync_mvnw.sh
├── .sdkmanrc
├── config
└── releaser.yml
├── spring-cloud-dependencies-parent
├── README.adoc
├── Guardfile
├── pom.xml
└── eclipse-code-formatter.xml
├── spring-cloud-build-tools
├── src
│ ├── main
│ │ └── resources
│ │ │ ├── intellij
│ │ │ ├── Intellij_Project_Defaults.xml
│ │ │ └── Intellij_Spring_Boot_Java_Conventions.xml
│ │ │ ├── checkstyle-header.txt
│ │ │ ├── LICENSE.txt
│ │ │ └── checkstyle.xml
│ └── checkstyle
│ │ ├── checkstyle-suppressions.xml
│ │ └── nohttp-checkstyle.xml
└── pom.xml
├── .gitmodules
├── .gitignore
├── .editorconfig
├── .settings.xml
├── spring-cloud-build-dependencies
└── pom.xml
├── mvnw.cmd
├── mvnw
├── LICENSE.txt
└── README.adoc
/.springformat:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.mvn/maven.config:
--------------------------------------------------------------------------------
1 | -P spring
2 |
--------------------------------------------------------------------------------
/docs/src/main/.gitignore:
--------------------------------------------------------------------------------
1 | META-INF/
2 | org/
--------------------------------------------------------------------------------
/.github/dco.yml:
--------------------------------------------------------------------------------
1 | require:
2 | members: false
3 |
--------------------------------------------------------------------------------
/docs/src/test/resources/included.adoc:
--------------------------------------------------------------------------------
1 | Hello world!
--------------------------------------------------------------------------------
/docs/src/test/resources/test.adoc:
--------------------------------------------------------------------------------
1 | include::included.adoc[]
--------------------------------------------------------------------------------
/docs/modules/ROOT/nav.adoc:
--------------------------------------------------------------------------------
1 | * xref:index.adoc[]
2 | * xref:building.adoc[]
3 | * xref:contributing.adoc[]
4 |
--------------------------------------------------------------------------------
/docs/modules/ROOT/pages/building.adoc:
--------------------------------------------------------------------------------
1 | [[building]]
2 | = Building
3 |
4 | include::partial$building.adoc[]
--------------------------------------------------------------------------------
/docs/modules/ROOT/pages/contributing.adoc:
--------------------------------------------------------------------------------
1 | [[contributing]]
2 | = Contributing
3 |
4 | include::partial$contributing.adoc[]
--------------------------------------------------------------------------------
/scripts/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | ./mvnw clean install -B -Pdocs ${@}
4 | #./mvnw clean install -B -DskipTests ${@}
5 |
--------------------------------------------------------------------------------
/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/HEAD/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/.sdkmanrc:
--------------------------------------------------------------------------------
1 | # Enable auto-env through the sdkman_auto_env config
2 | # Add key=value pairs of SDKs to use below
3 | java=17.0.1-tem
4 |
--------------------------------------------------------------------------------
/config/releaser.yml:
--------------------------------------------------------------------------------
1 | releaser:
2 | maven:
3 | buildCommand: ./scripts/build.sh {{systemProps}}
4 | # deployCommand: echo "skip deploy"
5 |
--------------------------------------------------------------------------------
/docs/modules/ROOT/assets/images/intellij-checkstyle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/HEAD/docs/modules/ROOT/assets/images/intellij-checkstyle.png
--------------------------------------------------------------------------------
/docs/modules/ROOT/assets/images/intellij-code-style.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/HEAD/docs/modules/ROOT/assets/images/intellij-code-style.png
--------------------------------------------------------------------------------
/docs/modules/ROOT/assets/images/intellij-inspections.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/HEAD/docs/modules/ROOT/assets/images/intellij-inspections.png
--------------------------------------------------------------------------------
/docs/modules/ROOT/pages/index.adoc:
--------------------------------------------------------------------------------
1 | [[overview]]
2 | = Overview
3 |
4 | Spring Cloud Build is a common utility project for Spring Cloud to use for plugin and dependency management.
--------------------------------------------------------------------------------
/spring-cloud-dependencies-parent/README.adoc:
--------------------------------------------------------------------------------
1 | // Do not edit this file (e.g. go instead to src/main/asciidoc)
2 |
3 | Spring Cloud Build is a common utility project for Spring Cloud
4 | to use for plugin and dependency management.
5 |
--------------------------------------------------------------------------------
/spring-cloud-build-tools/src/main/resources/intellij/Intellij_Project_Defaults.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip
2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
3 |
--------------------------------------------------------------------------------
/docs/modules/ROOT/partials/contributing-docs.adoc:
--------------------------------------------------------------------------------
1 | NOTE: Spring Cloud is released under the non-restrictive Apache 2.0 license. If you would like to contribute to this section of the documentation or if you find an error, please find the source code and issue trackers in the project at {github-project}[github].
2 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "docs/src/test/bats/test_helper/bats-assert"]
2 | path = docs/src/test/bats/test_helper/bats-assert
3 | url = https://github.com/ztombol/bats-assert
4 | [submodule "docs/src/test/bats/test_helper/bats-support"]
5 | path = docs/src/test/bats/test_helper/bats-support
6 | url = https://github.com/ztombol/bats-support
7 |
--------------------------------------------------------------------------------
/docs/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "antora": "3.2.0-alpha.11",
4 | "@antora/atlas-extension": "1.0.0-alpha.5",
5 | "@antora/collector-extension": "1.0.2",
6 | "@asciidoctor/tabs": "1.0.0-beta.6",
7 | "@springio/antora-extensions": "1.14.7",
8 | "@springio/asciidoctor-extensions": "1.0.0-alpha.17"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *~
2 | #*
3 | *#
4 | .#*
5 | .classpath
6 | .project
7 | .settings
8 | .springBeans
9 | .gradle
10 | build
11 | bin
12 | target/
13 | asciidoctor.css
14 | _site/
15 | *.swp
16 | .idea
17 | *.iml
18 | .factorypath
19 | .vscode/
20 | .flattened-pom.xml
21 | .DS_Store
22 | node_modules
23 | node
24 | _configprops.adoc
25 | _spans.adoc
26 | _metrics.adoc
27 | _conventions.adoc
28 | /package.json
29 | package-lock.json
30 |
--------------------------------------------------------------------------------
/docs/src/test/resources/not-matching-name.json:
--------------------------------------------------------------------------------
1 | {
2 | "properties": [
3 | {
4 | "defaultValue": "false",
5 | "name": "example1.first-property",
6 | "description": "First Description",
7 | "type": "java.lang.Boolean"
8 | },
9 | {
10 | "defaultValue": "true",
11 | "name": "example2.second-property",
12 | "description": "Second Description",
13 | "type": "java.lang.Boolean"
14 | }
15 | ]
16 | }
17 |
--------------------------------------------------------------------------------
/docs/src/test/resources/with-cloud-in-name.json:
--------------------------------------------------------------------------------
1 | {
2 | "properties": [
3 | {
4 | "defaultValue": "false",
5 | "name": "spring.first-property",
6 | "description": "First Description",
7 | "type": "java.lang.Boolean"
8 | },
9 | {
10 | "defaultValue": "true",
11 | "name": "unmatched.second-property",
12 | "description": "Second Description",
13 | "type": "java.lang.Boolean"
14 | }
15 | ]
16 | }
17 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*.java]
4 | indent_style = tab
5 | indent_size = 4
6 | continuation_indent_size = 8
7 |
8 | [*.groovy]
9 | indent_style = tab
10 | indent_size = 4
11 | continuation_indent_size = 8
12 |
13 | [*.xml]
14 | indent_style = tab
15 | indent_size = 4
16 | continuation_indent_size = 8
17 |
18 | [*.yml]
19 | indent_style = space
20 | indent_size = 2
21 |
22 | [*.yaml]
23 | indent_style = space
24 | indent_size = 2
25 |
26 | [*.sh]
27 | indent_style = space
28 | indent_size = 4
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | Please provide details of the problem, including the version of Spring Cloud that you
12 | are using.
13 |
14 | **Sample**
15 | If possible, please provide a test case or sample application that reproduces
16 | the problem. This makes it much easier for us to diagnose the problem and to verify that
17 | we have fixed it.
18 |
--------------------------------------------------------------------------------
/docs/antora.yml:
--------------------------------------------------------------------------------
1 | name: cloud-build
2 | version: true
3 | title: Spring Cloud Build
4 | nav:
5 | - modules/ROOT/nav.adoc
6 | ext:
7 | collector:
8 | run:
9 | command: ./mvnw --no-transfer-progress -B process-resources -Pdocs -pl docs -Dantora-maven-plugin.phase=none -Dgenerate-docs.phase=none -Dgenerate-readme.phase=none -Dgenerate-cloud-resources.phase=none -Dmaven-dependency-plugin-for-docs.phase=none -Dmaven-dependency-plugin-for-docs-classes.phase=none -DskipTests
10 | local: true
11 | scan:
12 | dir: ./target/classes/antora-resources/
13 |
--------------------------------------------------------------------------------
/spring-cloud-dependencies-parent/Guardfile:
--------------------------------------------------------------------------------
1 | require 'asciidoctor'
2 | require 'erb'
3 |
4 | options = {:mkdirs => true, :safe => :unsafe, :attributes => 'linkcss'}
5 |
6 | guard 'shell' do
7 | watch(/^[A-Za-z].*\.adoc$/) {|m|
8 | Asciidoctor.load_file('src/main/asciidoc/README.adoc', :to_file => './README.adoc', safe: :safe, parse: false)
9 | Asciidoctor.render_file('src/main/asciidoc/spring-cloud-build.adoc', options.merge(:to_dir => 'target/generated-docs'))
10 | Asciidoctor.render_file('src/main/asciidoc/building.adoc', options.merge(:to_dir => 'target/generated-docs'))
11 | }
12 | end
13 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/.mvn/jvm.config:
--------------------------------------------------------------------------------
1 | -Xmx1024m -XX:CICompilerCount=1 -XX:TieredStopAtLevel=1 -Djava.security.egd=file:/dev/./urandom
2 | --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
3 | --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
4 | --add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
5 | --add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED
6 | --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
7 | --add-exports jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED
8 | --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
9 | --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
10 | --add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
11 | --add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
21 |
--------------------------------------------------------------------------------
/spring-cloud-build-tools/src/main/resources/checkstyle-header.txt:
--------------------------------------------------------------------------------
1 | ^\Q/*\E$
2 | ^\Q * Copyright \E20\d\d\-present\Q the original author or authors.\E$
3 | ^\Q *\E$
4 | ^\Q * Licensed under the Apache License, Version 2.0 (the "License");\E$
5 | ^\Q * you may not use this file except in compliance with the License.\E$
6 | ^\Q * You may obtain a copy of the License at\E$
7 | ^\Q *\E$
8 | ^\Q * https://www.apache.org/licenses/LICENSE-2.0\E$
9 | ^\Q *\E$
10 | ^\Q * Unless required by applicable law or agreed to in writing, software\E$
11 | ^\Q * distributed under the License is distributed on an "AS IS" BASIS,\E$
12 | ^\Q * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\E$
13 | ^\Q * See the License for the specific language governing permissions and\E$
14 | ^\Q * limitations under the License.\E$
15 | ^\Q */\E$
16 | ^$
17 | ^.*$
18 |
--------------------------------------------------------------------------------
/spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/spring-cloud-build-tools/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 | spring-cloud-build-tools
7 | spring-cloud-build-tools
8 | jar
9 | Spring Cloud Build Tools
10 |
11 | org.springframework.cloud
12 | spring-cloud-build
13 | 5.0.1-SNAPSHOT
14 |
15 |
16 |
17 | com.puppycrawl.tools
18 | checkstyle
19 | ${puppycrawl-tools-checkstyle.version}
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/docs/antora-playbook.yml:
--------------------------------------------------------------------------------
1 | antora:
2 | extensions:
3 | - require: '@springio/antora-extensions'
4 | root_component_name: 'cloud-build'
5 | site:
6 | title: Spring Cloud Build
7 | url: https://docs.spring.io/spring-cloud-build/reference/
8 | content:
9 | sources:
10 | - url: ./..
11 | branches: HEAD
12 | start_path: docs
13 | worktrees: true
14 | asciidoc:
15 | attributes:
16 | page-stackoverflow-url: https://stackoverflow.com/tags/spring-cloud
17 | page-pagination: ''
18 | hide-uri-scheme: '@'
19 | tabs-sync-option: '@'
20 | chomp: 'all'
21 | extensions:
22 | - '@asciidoctor/tabs'
23 | - '@springio/asciidoctor-extensions'
24 | sourcemap: true
25 | urls:
26 | latest_version_segment: ''
27 | runtime:
28 | log:
29 | failure_level: warn
30 | format: pretty
31 | ui:
32 | bundle:
33 | url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.4.15/ui-bundle.zip
34 |
--------------------------------------------------------------------------------
/docs/src/main/antora/resources/antora-resources/antora.yml:
--------------------------------------------------------------------------------
1 | version: @antora-component.version@
2 | prerelease: @antora-component.prerelease@
3 |
4 | asciidoc:
5 | attributes:
6 | attribute-missing: 'warn'
7 | chomp: 'all'
8 | project-root: @maven.multiModuleProjectDirectory@
9 | github-repo: @docs.main@
10 | github-raw: https://raw.githubusercontent.com/spring-cloud/@docs.main@/@github-tag@
11 | github-code: https://github.com/spring-cloud/@docs.main@/tree/@github-tag@
12 | github-issues: https://github.com/spring-cloud/@docs.main@/issues/
13 | github-wiki: https://github.com/spring-cloud/@docs.main@/wiki
14 | spring-cloud-version: @project.version@
15 | github-tag: @github-tag@
16 | version-type: @version-type@
17 | docs-url: https://docs.spring.io/@docs.main@/docs/@project.version@
18 | raw-docs-url: https://raw.githubusercontent.com/spring-cloud/@docs.main@/@github-tag@
19 | project-version: @project.version@
20 | project-name: @docs.main@
21 |
--------------------------------------------------------------------------------
/.github/workflows/maven.yml:
--------------------------------------------------------------------------------
1 | # This workflow will build a Java project with Maven
2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
3 |
4 | name: Build
5 |
6 | on:
7 | push:
8 | branches: [ main, 4.3.x, 4.2.x]
9 | pull_request:
10 | branches: [ main, 4.3.x, 4.2.x]
11 |
12 | jobs:
13 | build:
14 |
15 | runs-on: ubuntu-latest
16 |
17 | steps:
18 | - uses: actions/checkout@v6
19 | - name: Set up JDK
20 | uses: actions/setup-java@v5
21 | with:
22 | java-version: 17
23 | distribution: 'temurin'
24 | - name: Cache local Maven repository
25 | uses: actions/cache@v5
26 | with:
27 | path: ~/.m2/repository
28 | key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
29 | restore-keys: |
30 | ${{ runner.os }}-maven-
31 | - name: Build with Maven
32 | run: ./mvnw clean install -Pdocs -B -U -Pspring
33 |
--------------------------------------------------------------------------------
/.github/workflows/deploy.yml:
--------------------------------------------------------------------------------
1 | name: Spring Cloud Build Deploy
2 |
3 | on:
4 | push:
5 | branches:
6 | - main
7 | - 4.3.x
8 |
9 | # Scheduled builds run daily at midnight UTC
10 | schedule:
11 | - cron: '0 0 * * *'
12 |
13 | # Manual trigger with optional branch override
14 | workflow_dispatch:
15 | inputs:
16 | branch:
17 | description: "Which branch should be built"
18 | required: true
19 | default: 'main'
20 | type: string
21 |
22 | jobs:
23 | deploy:
24 | uses: spring-cloud/spring-cloud-github-actions/.github/workflows/deploy.yml@main
25 | with:
26 | branch: ${{ inputs.branch }}
27 | secrets:
28 | ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
29 | ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
30 | COMMERCIAL_ARTIFACTORY_USERNAME: ${{ secrets.COMMERCIAL_ARTIFACTORY_USERNAME }}
31 | COMMERCIAL_ARTIFACTORY_PASSWORD: ${{ secrets.COMMERCIAL_ARTIFACTORY_PASSWORD }}
32 | DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
33 | DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
34 |
--------------------------------------------------------------------------------
/.github/workflows/deploy-docs.yml:
--------------------------------------------------------------------------------
1 | name: Deploy Docs
2 | on:
3 | push:
4 | branches-ignore: [ gh-pages ]
5 | tags: '**'
6 | repository_dispatch:
7 | types: request-build-reference # legacy
8 | #schedule:
9 | #- cron: '0 10 * * *' # Once per day at 10am UTC
10 | workflow_dispatch:
11 | permissions:
12 | actions: write
13 | jobs:
14 | build:
15 | runs-on: ubuntu-latest
16 | # FIXME: enable when pushed to spring-projects
17 | # if: github.repository_owner == 'spring-projects'
18 | steps:
19 | - name: Checkout
20 | uses: actions/checkout@v6
21 | with:
22 | ref: docs-build
23 | fetch-depth: 1
24 | - name: Dispatch (partial build)
25 | if: github.ref_type == 'branch'
26 | env:
27 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28 | run: gh workflow run deploy-docs.yml -r $(git rev-parse --abbrev-ref HEAD) -f build-refname=${{ github.ref_name }}
29 | - name: Dispatch (full build)
30 | if: github.ref_type == 'tag'
31 | env:
32 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33 | run: gh workflow run deploy-docs.yml -r $(git rev-parse --abbrev-ref HEAD)
34 |
--------------------------------------------------------------------------------
/docs/src/test/java/org/springframework/cloud/internal/MainTests.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013-2019 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.springframework.cloud.internal;
18 |
19 | import java.io.File;
20 |
21 | import org.junit.jupiter.api.Test;
22 |
23 | import static org.assertj.core.api.BDDAssertions.then;
24 |
25 | class MainTests {
26 |
27 | @Test
28 | void should_do_nothing_when_parent_dir_is_not_found() {
29 | File nonExistantFile = new File("/this/file/does/not/exist");
30 |
31 | Main.main(nonExistantFile.getAbsolutePath());
32 |
33 | then(nonExistantFile).doesNotExist();
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/docs/src/test/java/org/springframework/cloud/internal/asciidoctor/ReadmeMainTests.java:
--------------------------------------------------------------------------------
1 | package org.springframework.cloud.internal.asciidoctor;
2 |
3 | import java.io.File;
4 | import java.io.IOException;
5 | import java.net.URISyntaxException;
6 | import java.nio.file.Files;
7 |
8 | import org.junit.jupiter.api.Test;
9 |
10 | import static org.assertj.core.api.BDDAssertions.then;
11 |
12 | class ReadmeMainTests {
13 |
14 | @Test
15 | void should_convert_input_with_include_of_external_sources_to_a_single_file() throws URISyntaxException, IOException {
16 | File inputFile = new File(ReadmeMainTests.class.getResource("/README.adoc").toURI());
17 | File outputFile = deleteIfExists(new File("target/output.adoc"));
18 |
19 | ReadmeMain.main(inputFile.getAbsolutePath(), outputFile.getAbsolutePath());
20 |
21 | then(new String(Files.readAllBytes(outputFile.toPath())))
22 | .doesNotContain("include:")
23 | .doesNotContain("Unresolved directive")
24 | .contains("DO NOT EDIT THIS FILE. IT WAS GENERATED")
25 | .contains("Hello world!");
26 | then(new File("target/output.html"))
27 | .as("Conversion to HTML must not happen").doesNotExist();
28 | }
29 |
30 | private File deleteIfExists(File outputFile) {
31 | if (outputFile.exists()) {
32 | outputFile.delete();
33 | }
34 | return outputFile;
35 | }
36 | }
--------------------------------------------------------------------------------
/spring-cloud-build-tools/src/checkstyle/nohttp-checkstyle.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
29 |
--------------------------------------------------------------------------------
/docs/modules/ROOT/partials/code-of-conduct.adoc:
--------------------------------------------------------------------------------
1 | [[contributor-code-of-conduct]]
2 | == Contributor Code of Conduct
3 |
4 | As contributors and maintainers of this project, and in the interest of fostering an open
5 | and welcoming community, we pledge to respect all people who contribute through reporting
6 | issues, posting feature requests, updating documentation, submitting pull requests or
7 | patches, and other activities.
8 |
9 | We are committed to making participation in this project a harassment-free experience for
10 | everyone, regardless of level of experience, gender, gender identity and expression,
11 | sexual orientation, disability, personal appearance, body size, race, ethnicity, age,
12 | religion, or nationality.
13 |
14 | Examples of unacceptable behavior by participants include:
15 |
16 | * The use of sexualized language or imagery
17 | * Personal attacks
18 | * Trolling or insulting/derogatory comments
19 | * Public or private harassment
20 | * Publishing other's private information, such as physical or electronic addresses,
21 | without explicit permission
22 | * Other unethical or unprofessional conduct
23 |
24 | Project maintainers have the right and responsibility to remove, edit, or reject comments,
25 | commits, code, wiki edits, issues, and other contributions that are not aligned to this
26 | Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors
27 | that they deem inappropriate, threatening, offensive, or harmful.
28 |
29 | By adopting this Code of Conduct, project maintainers commit themselves to fairly and
30 | consistently applying these principles to every aspect of managing this project. Project
31 | maintainers who do not follow or enforce the Code of Conduct may be permanently removed
32 | from the project team.
33 |
34 | This Code of Conduct applies both within project spaces and in public spaces when an
35 | individual is representing the project or its community.
36 |
37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by
38 | contacting a project maintainer at spring-code-of-conduct@pivotal.io . All complaints will
39 | be reviewed and investigated and will result in a response that is deemed necessary and
40 | appropriate to the circumstances. Maintainers are obligated to maintain confidentiality
41 | with regard to the reporter of an incident.
42 |
43 | This Code of Conduct is adapted from the
44 | https://contributor-covenant.org[Contributor Covenant], version 1.3.0, available at
45 | https://contributor-covenant.org/version/1/3/0/[contributor-covenant.org/version/1/3/0/]
46 |
--------------------------------------------------------------------------------
/docs/src/main/java/org/springframework/cloud/internal/asciidoctor/ReadmeMain.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012-2020 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.springframework.cloud.internal.asciidoctor;
18 |
19 | import java.io.File;
20 | import java.io.IOException;
21 | import java.nio.file.Files;
22 |
23 | import org.asciidoctor.Asciidoctor;
24 | import org.asciidoctor.Attributes;
25 | import org.asciidoctor.Options;
26 | import org.asciidoctor.SafeMode;
27 |
28 | public class ReadmeMain {
29 | public static void main(String... args) {
30 | File inputFile = new File(args[0]);
31 | File outputFile = new File(args[1]);
32 | System.out.println("Will do the Readme conversion from [" + inputFile + "] to [" + outputFile + "]");
33 | if (!inputFile.exists()) {
34 | System.out.println("There's no file [" + inputFile + "], skipping readme generation");
35 | return;
36 | }
37 | new ReadmeMain().convert(inputFile, outputFile);
38 | }
39 |
40 | void convert(File input, File output) {
41 | Asciidoctor asciidoctor = Asciidoctor.Factory.create();
42 | asciidoctor.javaExtensionRegistry().preprocessor(new CoalescerPreprocessor(output));
43 | Options options = options(input, output);
44 | try {
45 | String fileAsString = new String(Files.readAllBytes(input.toPath()));
46 | asciidoctor.convert(fileAsString, options);
47 | System.out.println("Successfully converted the Readme file!\n");
48 | } catch (IOException ex) {
49 | throw new IllegalStateException("Failed to convert the file", ex);
50 | }
51 | }
52 |
53 | private Options options(File input, File output) {
54 | Attributes attributes = Attributes.builder()
55 | .allowUriRead(true)
56 | .attribute("project-root", output.getParent())
57 | .build();
58 |
59 | return Options.builder()
60 | .sourceDir(input.getParentFile())
61 | .baseDir(input.getParentFile())
62 | .attributes(attributes)
63 | .safe(SafeMode.UNSAFE)
64 | .parseHeaderOnly(true)
65 | .build();
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/.settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 | repo.spring.io
22 | ${env.CI_DEPLOY_USERNAME}
23 | ${env.CI_DEPLOY_PASSWORD}
24 |
25 |
26 |
27 |
28 |
34 | spring
35 |
36 | true
37 |
38 |
39 |
40 | spring-snapshots
41 | Spring Snapshots
42 | https://repo.spring.io/snapshot
43 |
44 | true
45 |
46 |
47 |
48 | spring-milestones
49 | Spring Milestones
50 | https://repo.spring.io/milestone
51 |
52 | false
53 |
54 |
55 |
56 |
57 |
58 | spring-snapshots
59 | Spring Snapshots
60 | https://repo.spring.io/snapshot
61 |
62 | true
63 |
64 |
65 |
66 | spring-milestones
67 | Spring Milestones
68 | https://repo.spring.io/milestone
69 |
70 | false
71 |
72 |
73 |
74 |
75 |
76 |
79 | ide
80 |
81 | true
82 |
83 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/.github/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 |
2 | # Contributing
3 |
4 | Spring Cloud is released under the non-restrictive Apache 2.0 license,
5 | and follows a very standard Github development process, using Github
6 | tracker for issues and merging pull requests into master. If you want
7 | to contribute even something trivial please do not hesitate, but
8 | follow the guidelines below.
9 |
10 | ## Sign the Contributor License Agreement
11 | Before we accept a non-trivial patch or pull request we will need you to sign the
12 | [Contributor License Agreement](https://cla.pivotal.io/sign/spring).
13 | Signing the contributor's agreement does not grant anyone commit rights to the main
14 | repository, but it does mean that we can accept your contributions, and you will get an
15 | author credit if we do. Active contributors might be asked to join the core team, and
16 | given the ability to merge pull requests.
17 |
18 | ## Code of Conduct
19 | This project adheres to the Contributor Covenant [code of
20 | conduct](https://github.com/spring-cloud/spring-cloud-build/blob/main/docs/modules/ROOT/partials/code-of-conduct.adoc). By participating, you are expected to uphold this code. Please report
21 | unacceptable behavior to spring-code-of-conduct@pivotal.io.
22 |
23 | ## Code Conventions and Housekeeping
24 | None of these is essential for a pull request, but they will all help. They can also be
25 | added after the original pull request but before a merge.
26 |
27 | * Use the Spring Framework code format conventions. If you use Eclipse
28 | you can import formatter settings using the
29 | `eclipse-code-formatter.xml` file from the
30 | [Spring Cloud Build](https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-dependencies-parent/eclipse-code-formatter.xml) project. If using IntelliJ, you can use the
31 | [Eclipse Code Formatter Plugin](https://plugins.jetbrains.com/plugin/6546) to import the same file.
32 | * Make sure all new `.java` files to have a simple Javadoc class comment with at least an
33 | `@author` tag identifying you, and preferably at least a paragraph on what the class is
34 | for.
35 | * Add the ASF license header comment to all new `.java` files (copy from existing files
36 | in the project)
37 | * Add yourself as an `@author` to the .java files that you modify substantially (more
38 | than cosmetic changes).
39 | * Add some Javadocs and, if you change the namespace, some XSD doc elements.
40 | * A few unit tests would help a lot as well -- someone has to do it.
41 | * If no-one else is using your branch, please rebase it against the current master (or
42 | other target branch in the main project).
43 | * When writing a commit message please follow [these conventions](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html),
44 | if you are fixing an existing issue please add `Fixes gh-XXXX` at the end of the commit
45 | message (where XXXX is the issue number).
46 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | # To get started with Dependabot version updates, you'll need to specify which
2 | # package ecosystems to update and where the package manifests are located.
3 | # Please see the documentation for all configuration options:
4 | # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5 |
6 | version: 2
7 |
8 | updates:
9 | - package-ecosystem: "github-actions"
10 | directory: "/"
11 | target-branch: "main"
12 | schedule:
13 | interval: "weekly"
14 | - package-ecosystem: "github-actions"
15 | directory: "/"
16 | target-branch: "4.3.x"
17 | schedule:
18 | interval: "weekly"
19 | - package-ecosystem: "github-actions"
20 | directory: "/"
21 | target-branch: "4.2.x"
22 | schedule:
23 | interval: "weekly"
24 | - package-ecosystem: maven
25 | directory: /
26 | schedule:
27 | interval: daily
28 | target-branch: main
29 | ignore:
30 | # IDE specific dependency
31 | - dependency-name: "org.eclipse.m2e:lifecycle-mapping"
32 | # JRuby updates are causing docs generation to fail
33 | - dependency-name: "org.jruby:jruby-complete"
34 | # only upgrade by minor or patch
35 | - dependency-name: "*"
36 | update-types:
37 | - version-update:semver-major
38 | - version-update:semver-minor
39 | - package-ecosystem: maven
40 | directory: /
41 | schedule:
42 | interval: daily
43 | target-branch: 4.3.x
44 | ignore:
45 | # IDE specific dependency
46 | - dependency-name: "org.eclipse.m2e:lifecycle-mapping"
47 | # JRuby updates are causing docs generation to fail
48 | - dependency-name: "org.jruby:jruby-complete"
49 | # only upgrade by minor or patch
50 | - dependency-name: "*"
51 | update-types:
52 | - version-update:semver-major
53 | - version-update:semver-minor
54 | - package-ecosystem: maven
55 | directory: /
56 | schedule:
57 | interval: daily
58 | target-branch: 4.2.x
59 | ignore:
60 | # IDE specific dependency
61 | - dependency-name: "org.eclipse.m2e:lifecycle-mapping"
62 | # JRuby updates are causing docs generation to fail
63 | - dependency-name: "org.jruby:jruby-complete"
64 | # only upgrade by minor or patch
65 | - dependency-name: "*"
66 | update-types:
67 | - version-update:semver-major
68 | - version-update:semver-minor
69 | - package-ecosystem: npm
70 | target-branch: docs-build
71 | directory: /
72 | schedule:
73 | interval: weekly
74 | - package-ecosystem: npm
75 | target-branch: main
76 | directory: /docs
77 | schedule:
78 | interval: weekly
79 | - package-ecosystem: npm
80 | target-branch: 4.3.x
81 | directory: /docs
82 | schedule:
83 | interval: weekly
84 | - package-ecosystem: npm
85 | target-branch: 4.2.x
86 | directory: /docs
87 | schedule:
88 | interval: weekly
89 |
--------------------------------------------------------------------------------
/docs/modules/ROOT/partials/building.adoc:
--------------------------------------------------------------------------------
1 | :jdkversion: 17
2 |
3 | [[basic-compile-and-test]]
4 | == Basic Compile and Test
5 |
6 | To build the source you will need to install JDK {jdkversion}.
7 |
8 | Spring Cloud uses Maven for most build-related activities, and you
9 | should be able to get off the ground quite quickly by cloning the
10 | project you are interested in and typing
11 |
12 | ----
13 | $ ./mvnw install
14 | ----
15 |
16 | NOTE: You can also install Maven (>=3.3.3) yourself and run the `mvn` command
17 | in place of `./mvnw` in the examples below. If you do that you also
18 | might need to add `-P spring` if your local Maven settings do not
19 | contain repository declarations for spring pre-release artifacts.
20 |
21 | NOTE: Be aware that you might need to increase the amount of memory
22 | available to Maven by setting a `MAVEN_OPTS` environment variable with
23 | a value like `-Xmx512m -XX:MaxPermSize=128m`. We try to cover this in
24 | the `.mvn` configuration, so if you find you have to do it to make a
25 | build succeed, please raise a ticket to get the settings added to
26 | source control.
27 |
28 | The projects that require middleware (i.e. Redis) for testing generally
29 | require that a local instance of https://www.docker.com/get-started[Docker] is installed and running.
30 |
31 | [[documentation]]
32 | == Documentation
33 |
34 | The spring-cloud-build module has a "docs" profile, and if you switch
35 | that on it will try to build asciidoc sources using https://docs.antora.org/antora/latest/[Antora] from
36 | `modules/ROOT/`.
37 |
38 | As part of that process it will look for a
39 | `docs/src/main/asciidoc/README.adoc` and process it by loading all the includes, but not
40 | parsing or rendering it, just copying it to `${main.basedir}`
41 | (defaults to `$\{basedir}`, i.e. the root of the project). If there are
42 | any changes in the README it will then show up after a Maven build as
43 | a modified file in the correct place. Just commit it and push the change.
44 |
45 | [[working-with-the-code]]
46 | == Working with the code
47 | If you don't have an IDE preference we would recommend that you use
48 | https://spring.io/tools[Spring Tools Suite] or
49 | https://eclipse.org[Eclipse] when working with the code. We use the
50 | https://eclipse.org/m2e/[m2eclipse] eclipse plugin for maven support. Other IDEs and tools
51 | should also work without issue as long as they use Maven 3.3.3 or better.
52 |
53 | [[activate-the-spring-maven-profile]]
54 | === Activate the Spring Maven profile
55 | Spring Cloud projects require the 'spring' Maven profile to be activated to resolve
56 | the spring milestone and snapshot repositories. Use your preferred IDE to set this
57 | profile to be active, or you may experience build errors.
58 |
59 | [[importing-into-eclipse-with-m2eclipse]]
60 | === Importing into eclipse with m2eclipse
61 | We recommend the https://eclipse.org/m2e/[m2eclipse] eclipse plugin when working with
62 | eclipse. If you don't already have m2eclipse installed it is available from the "eclipse
63 | marketplace".
64 |
65 | NOTE: Older versions of m2e do not support Maven 3.3, so once the
66 | projects are imported into Eclipse you will also need to tell
67 | m2eclipse to use the right profile for the projects. If you
68 | see many different errors related to the POMs in the projects, check
69 | that you have an up to date installation. If you can't upgrade m2e,
70 | add the "spring" profile to your `settings.xml`. Alternatively you can
71 | copy the repository settings from the "spring" profile of the parent
72 | pom into your `settings.xml`.
73 |
74 | [[importing-into-eclipse-without-m2eclipse]]
75 | === Importing into eclipse without m2eclipse
76 | If you prefer not to use m2eclipse you can generate eclipse project metadata using the
77 | following command:
78 |
79 | [indent=0]
80 | ----
81 | $ ./mvnw eclipse:eclipse
82 | ----
83 |
84 | The generated eclipse projects can be imported by selecting `import existing projects`
85 | from the `file` menu.
86 |
87 |
--------------------------------------------------------------------------------
/docs/src/test/java/org/springframework/cloud/internal/GeneratorTests.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013-2019 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.springframework.cloud.internal;
18 |
19 | import java.io.File;
20 | import java.io.IOException;
21 | import java.net.URISyntaxException;
22 | import java.net.URL;
23 | import java.nio.file.Files;
24 |
25 | import org.junit.jupiter.api.Test;
26 |
27 | import org.springframework.core.io.FileSystemResource;
28 | import org.springframework.core.io.Resource;
29 |
30 | import static org.assertj.core.api.BDDAssertions.then;
31 |
32 | class GeneratorTests {
33 |
34 | URL root = GeneratorTests.class.getResource(".");
35 |
36 | @Test
37 | void should_not_create_a_file_when_no_properties_were_found()
38 | throws URISyntaxException {
39 | Main.Generator generator = new Main.Generator() {
40 | @Override
41 | protected Resource[] getResources() {
42 | return new Resource[0];
43 | }
44 | };
45 | File file = new File(root.toURI().toString(), "output.adoc");
46 | String inclusionPattern = ".*";
47 |
48 | generator.generate(file.getAbsolutePath(), inclusionPattern);
49 |
50 | then(file).doesNotExist();
51 | }
52 |
53 | @Test
54 | void should_create_a_file_when_cloud_file_was_found() {
55 | Main.Generator generator = new Main.Generator() {
56 | @Override
57 | protected Resource[] getResources() {
58 | return new Resource[] { resource("/not-matching-name.json"),
59 | resource("/with-cloud-in-name.json") };
60 | }
61 |
62 | @Override
63 | protected boolean resourceNameContainsPattern(Resource resource) {
64 | try {
65 | return resource.getURI().toString().contains("with-cloud");
66 | }
67 | catch (IOException ex) {
68 | throw new IllegalStateException(ex);
69 | }
70 | }
71 | };
72 | File file = new File(root.getFile().toString(), "output.adoc");
73 | String inclusionPattern = ".*";
74 |
75 | generator.generate(file.getAbsolutePath(), inclusionPattern);
76 |
77 | then(file).exists();
78 | then(asString(file)).contains("spring.first-property")
79 | .contains("unmatched.second-property")
80 | .doesNotContain("example1.first-property");
81 | }
82 |
83 | @Test
84 | void should_create_a_file_when_spring_property_was_found() {
85 | Main.Generator generator = new Main.Generator() {
86 | @Override
87 | protected Resource[] getResources() {
88 | return new Resource[] { resource("/not-matching-name.json"),
89 | resource("/with-cloud-in-name.json") };
90 | }
91 | };
92 | File file = new File(root.getFile().toString(), "output.adoc");
93 | String inclusionPattern = "spring.*";
94 |
95 | generator.generate(file.getAbsolutePath(), inclusionPattern);
96 |
97 | then(file).exists();
98 | then(asString(file)).contains("spring.first-property")
99 | .doesNotContain("example1.first-property")
100 | .doesNotContain("unmatched.second-property");
101 | }
102 |
103 | static String asString(File file) {
104 | try {
105 | return new String(Files.readAllBytes(file.toPath()));
106 | }
107 | catch (IOException ex) {
108 | throw new IllegalStateException(ex);
109 | }
110 | }
111 |
112 | static Resource resource(String path) {
113 | return new FileSystemResource(GeneratorTests.class.getResource(path).getFile());
114 | }
115 |
116 | }
117 |
--------------------------------------------------------------------------------
/docs/src/main/java/org/springframework/cloud/internal/asciidoctor/CoalescerPreprocessor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012-2020 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.springframework.cloud.internal.asciidoctor;
18 |
19 | import java.io.File;
20 | import java.io.IOException;
21 | import java.nio.file.Files;
22 | import java.util.Arrays;
23 | import java.util.LinkedList;
24 | import java.util.List;
25 |
26 | import org.asciidoctor.ast.Document;
27 | import org.asciidoctor.extension.Preprocessor;
28 | import org.asciidoctor.extension.PreprocessorReader;
29 |
30 | // taken from https://github.com/hibernate/hibernate-asciidoctor-extensions/blob/1.0.3.Final/src/main/java/org/hibernate/infra/asciidoctor/extensions/savepreprocessed/SavePreprocessedOutputPreprocessor.java
31 | /**
32 | * Preprocessor used to save the preprocessed output of the asciidoctor conversion. It allows to generate a single file
33 | * integrating all the includes.
34 | *
35 | * @author Guillaume Smet
36 | */
37 | class CoalescerPreprocessor extends Preprocessor {
38 |
39 | private final File outputFile;
40 |
41 | private static final List FILTER_LICENSE_MARKERS = Arrays.asList("[preface]", "<<<");
42 |
43 | private static final String COMMENT_MARKER = "//";
44 |
45 | private static final String SOURCE_MARKER = "[source";
46 |
47 | private static final List SECTION_MARKERS = Arrays.asList("----", "....");
48 |
49 | private static final String HEADER = "////\n" + "DO NOT EDIT THIS FILE. IT WAS GENERATED.\n"
50 | + "Manual changes to this file will be lost when it is generated again.\n"
51 | + "Edit the files in the src/main/asciidoc/ directory instead.\n" + "////\n\n";
52 |
53 | CoalescerPreprocessor(File output_file) {
54 | outputFile = output_file;
55 | }
56 |
57 | @Override
58 | public void process(Document document, PreprocessorReader preprocessorReader) {
59 | try {
60 | LinkedList filteredLines = filterLines(preprocessorReader.readLines());
61 | filteredLines.addFirst(HEADER);
62 | Files.write(outputFile.toPath(), filteredLines);
63 | }
64 | catch (IOException e) {
65 | throw new IllegalStateException("Unable to write the preprocessed file " + outputFile, e);
66 | }
67 | }
68 |
69 | /**
70 | * This is used to filter out the license headers that are just after the markers
71 | * defined. It also reindents the source code with spaces to be consistent with the
72 | * 1.1 spec.
73 | */
74 | private LinkedList filterLines(List lines) {
75 | LinkedList filteredLines = new LinkedList<>();
76 | ParsingState state = ParsingState.NORMAL;
77 | int counter = 0;
78 | for (String line : lines) {
79 | counter++;
80 | switch (state) {
81 | case NORMAL:
82 | if (FILTER_LICENSE_MARKERS.contains(line)) {
83 | state = ParsingState.FILTER_LICENSE;
84 | }
85 | else if (line.startsWith(SOURCE_MARKER)) {
86 | state = ParsingState.SOURCE;
87 | }
88 | break;
89 | case SOURCE:
90 | if (SECTION_MARKERS.contains(line)) {
91 | state = ParsingState.SOURCE_CONTENT;
92 | }
93 | else {
94 | System.err.println("[source] requires to be followed by a section marker and line number [" + counter + "] with content [" + line + "] doesn't have it");
95 | }
96 | break;
97 | case SOURCE_CONTENT:
98 | if (SECTION_MARKERS.contains(line)) {
99 | state = ParsingState.NORMAL;
100 | }
101 | else {
102 | filteredLines.add(line.replaceAll("\t", " "));
103 | continue;
104 | }
105 | break;
106 | case FILTER_LICENSE:
107 | if (line.startsWith(COMMENT_MARKER)) {
108 | continue;
109 | }
110 | else {
111 | state = ParsingState.NORMAL;
112 | }
113 | break;
114 | }
115 | filteredLines.add(line);
116 | }
117 | return filteredLines;
118 | }
119 |
120 | private enum ParsingState {
121 |
122 | NORMAL, FILTER_LICENSE, SOURCE, SOURCE_CONTENT,
123 |
124 | }
125 |
126 | }
127 |
--------------------------------------------------------------------------------
/docs/src/main/asciidoc/README.adoc:
--------------------------------------------------------------------------------
1 | image::https://github.com/spring-cloud/spring-cloud-build/workflows/Build/badge.svg?branch=main&style=svg["Build",link="https://github.com/spring-cloud/spring-cloud-build/actions"]
2 |
3 | Spring Cloud Build is a common utility project for Spring Cloud
4 | to use for plugin and dependency management.
5 |
6 | [[building-and-deploying]]
7 | = Building and Deploying
8 |
9 | To install locally:
10 |
11 | ----
12 |
13 | $ mvn install -s .settings.xml
14 | ----
15 |
16 | and to deploy snapshots to repo.spring.io:
17 |
18 | ----
19 | $ mvn deploy -DaltSnapshotDeploymentRepository=repo.spring.io::default::https://repo.spring.io/snapshot
20 | ----
21 |
22 | and for Maven Central use
23 |
24 | ----
25 | $ mvn deploy -P central -DaltReleaseDeploymentRepository=sonatype-nexus-staging::default::https://oss.sonatype.org/service/local/staging/deploy/maven2
26 | ----
27 |
28 | (the "central" profile is available for all projects in Spring Cloud and it sets up the gpg jar signing, and the repository has to be specified separately for this project because it is a parent of the starter parent which users in turn have as their own parent).
29 |
30 | [[contributing]]
31 | = Contributing
32 |
33 | include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/modules/ROOT/partials/contributing.adoc[]
34 |
35 | [[flattening-the-poms]]
36 | = Flattening the POMs
37 |
38 | To avoid propagating build setup that is required to build a Spring Cloud project, we're using the maven flatten plugin. It has the advantage of letting you use whatever features you need while publishing "clean" pom to the repository.
39 |
40 | In order to add it, add the `org.codehaus.mojo:flatten-maven-plugin` to your `pom.xml`.
41 |
42 | [source,xml]
43 | ----
44 |
45 |
46 |
47 | org.codehaus.mojo
48 | flatten-maven-plugin
49 |
50 |
51 |
52 | ----
53 |
54 | [[reusing-the-documentation]]
55 | = Reusing the documentation
56 |
57 | Spring Cloud Build publishes its `spring-cloud-build-docs` module that contains
58 | helpful scripts (e.g. README generation ruby script) and css, xslt and images
59 | for the Spring Cloud documentation. If you want to follow the same convention
60 | approach of generating documentation just add these plugins to your `docs` module
61 |
62 | [source,xml]
63 | ----
64 | include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/pom.xml[indent=0,tags=docs]
65 | ----
66 |
67 | IMPORTANT: The order of plugin declaration is important!
68 |
69 | In order for the build to generate the `adoc` file with all your configuration properties, your `docs` module should contain all the dependencies on the classpath, that you would want to scan for configuration properties.
70 |
71 | If you want to modify which of the configuration properties are put in the table, you can tweak the `configprops.inclusionPattern` pattern to include only a subset of the properties (e.g. `spring.sleuth.*`).
72 |
73 | Spring Cloud Build Docs comes with a set of attributes for asciidoctor that you can reuse.
74 |
75 | [source,yml]
76 | ----
77 | include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/src/main/antora/resources/antora-resources/antora.yml[indent=0]
78 | ----
79 |
80 | [[updating-the-guides]]
81 | = Updating the guides
82 |
83 | We assume that your project contains guides under the `guides` folder.
84 |
85 | ```
86 | .
87 | └── guides
88 | ├── gs-guide1
89 | ├── gs-guide2
90 | └── gs-guide3
91 | ```
92 |
93 | This means that the project contains 3 guides that would
94 | correspond to the following guides in Spring Guides org.
95 |
96 | - https://github.com/spring-guides/gs-guide1
97 | - https://github.com/spring-guides/gs-guide2
98 | - https://github.com/spring-guides/gs-guide3
99 |
100 | If you deploy your project with the `-Pguides` profile like this
101 |
102 | ```
103 | $ ./mvnw clean deploy -Pguides
104 | ```
105 |
106 | what will happen is that for GA project versions, we will clone `gs-guide1`, `gs-guide2` and `gs-guide3` and update their contents with the ones being under your `guides` project.
107 |
108 | You can skip this by either not adding the `guides` profile, or passing the `-DskipGuides` system property when the profile is turned on.
109 |
110 | You can configure the project version passed to guides via the `guides-project.version` (defaults to `${project.version}`). The phase at which guides get updated can be configured by `guides-update.phase` (defaults to `deploy`).
111 |
--------------------------------------------------------------------------------
/spring-cloud-build-tools/src/main/resources/intellij/Intellij_Spring_Boot_Java_Conventions.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/docs/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 | spring-cloud-build-docs
7 | spring-cloud-build-docs
8 | jar
9 | Spring Cloud Build Docs
10 |
11 | org.springframework.cloud
12 | spring-cloud-build
13 | 5.0.1-SNAPSHOT
14 |
15 |
16 | spring-cloud-build
17 | ${basedir}/..
18 |
19 | none
20 | none
21 | none
22 | ${project.basedir}/src/main/
23 |
24 |
25 | deploy
26 |
27 | maven.compile.classpath
28 |
29 |
30 |
31 |
32 |
33 | org.springframework
34 | spring-core
35 | compile
36 |
37 |
38 | ch.qos.logback
39 | logback-classic
40 |
41 |
42 | org.apache.logging.log4j
43 | log4j-to-slf4j
44 |
45 |
46 | org.slf4j
47 | jul-to-slf4j
48 |
49 |
50 | com.fasterxml.jackson.core
51 | jackson-databind
52 | compile
53 |
54 |
55 |
56 | org.asciidoctor
57 | asciidoctorj
58 | ${asciidoctorj.version}
59 | compile
60 |
61 |
62 | org.springframework.boot
63 | spring-boot-starter-test
64 | test
65 |
66 |
67 |
68 |
69 |
70 | org.apache.maven.plugins
71 | maven-assembly-plugin
72 | 3.7.1
73 |
74 |
75 | jar-with-dependencies
76 |
77 |
78 |
79 |
80 | make-assembly
81 | package
82 |
83 | single
84 |
85 |
86 |
87 |
88 |
89 | maven-deploy-plugin
90 | ${maven-deploy-plugin.version}
91 |
92 |
93 |
94 |
95 |
96 |
97 | docs
98 |
99 |
100 |
101 | src/main/antora/resources/antora-resources
102 | true
103 |
104 |
105 |
106 |
107 | pl.project13.maven
108 | git-commit-id-plugin
109 |
110 |
111 | org.apache.maven.plugins
112 | maven-dependency-plugin
113 |
114 |
115 | org.codehaus.mojo
116 | exec-maven-plugin
117 |
118 |
119 | io.spring.maven.antora
120 | antora-component-version-maven-plugin
121 |
122 |
123 | org.antora
124 | antora-maven-plugin
125 |
126 |
127 | org.apache.maven.plugins
128 | maven-antrun-plugin
129 |
130 |
131 | maven-deploy-plugin
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
--------------------------------------------------------------------------------
/.mvn/wrapper/MavenWrapperDownloader.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2007-present the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | import java.net.*;
17 | import java.io.*;
18 | import java.nio.channels.*;
19 | import java.util.Properties;
20 |
21 | public class MavenWrapperDownloader {
22 |
23 | private static final String WRAPPER_VERSION = "0.5.6";
24 | /**
25 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
26 | */
27 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
28 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
29 |
30 | /**
31 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
32 | * use instead of the default one.
33 | */
34 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
35 | ".mvn/wrapper/maven-wrapper.properties";
36 |
37 | /**
38 | * Path where the maven-wrapper.jar will be saved to.
39 | */
40 | private static final String MAVEN_WRAPPER_JAR_PATH =
41 | ".mvn/wrapper/maven-wrapper.jar";
42 |
43 | /**
44 | * Name of the property which should be used to override the default download url for the wrapper.
45 | */
46 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
47 |
48 | public static void main(String args[]) {
49 | System.out.println("- Downloader started");
50 | File baseDirectory = new File(args[0]);
51 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
52 |
53 | // If the maven-wrapper.properties exists, read it and check if it contains a custom
54 | // wrapperUrl parameter.
55 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
56 | String url = DEFAULT_DOWNLOAD_URL;
57 | if(mavenWrapperPropertyFile.exists()) {
58 | FileInputStream mavenWrapperPropertyFileInputStream = null;
59 | try {
60 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
61 | Properties mavenWrapperProperties = new Properties();
62 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
63 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
64 | } catch (IOException e) {
65 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
66 | } finally {
67 | try {
68 | if(mavenWrapperPropertyFileInputStream != null) {
69 | mavenWrapperPropertyFileInputStream.close();
70 | }
71 | } catch (IOException e) {
72 | // Ignore ...
73 | }
74 | }
75 | }
76 | System.out.println("- Downloading from: " + url);
77 |
78 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
79 | if(!outputFile.getParentFile().exists()) {
80 | if(!outputFile.getParentFile().mkdirs()) {
81 | System.out.println(
82 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
83 | }
84 | }
85 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
86 | try {
87 | downloadFileFromURL(url, outputFile);
88 | System.out.println("Done");
89 | System.exit(0);
90 | } catch (Throwable e) {
91 | System.out.println("- Error downloading");
92 | e.printStackTrace();
93 | System.exit(1);
94 | }
95 | }
96 |
97 | private static void downloadFileFromURL(String urlString, File destination) throws Exception {
98 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
99 | String username = System.getenv("MVNW_USERNAME");
100 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
101 | Authenticator.setDefault(new Authenticator() {
102 | @Override
103 | protected PasswordAuthentication getPasswordAuthentication() {
104 | return new PasswordAuthentication(username, password);
105 | }
106 | });
107 | }
108 | URL website = new URL(urlString);
109 | ReadableByteChannel rbc;
110 | rbc = Channels.newChannel(website.openStream());
111 | FileOutputStream fos = new FileOutputStream(destination);
112 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
113 | fos.close();
114 | rbc.close();
115 | }
116 |
117 | }
118 |
--------------------------------------------------------------------------------
/docs/src/main/java/org/springframework/cloud/internal/Main.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012-2020 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.springframework.cloud.internal;
18 |
19 | import java.io.File;
20 | import java.io.IOException;
21 | import java.nio.file.Files;
22 | import java.util.HashMap;
23 | import java.util.List;
24 | import java.util.Map;
25 | import java.util.TreeSet;
26 | import java.util.concurrent.atomic.AtomicInteger;
27 | import java.util.regex.Pattern;
28 | import java.util.stream.Collectors;
29 |
30 | import com.fasterxml.jackson.databind.ObjectMapper;
31 |
32 | import org.springframework.core.io.Resource;
33 | import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
34 | import org.springframework.util.StreamUtils;
35 | import org.springframework.util.StringUtils;
36 |
37 | /**
38 | * @author Marcin Grzejszczak
39 | */
40 | public class Main {
41 |
42 | public static void main(String... args) {
43 | String outputFile = args[0];
44 | String inclusionPattern = args.length > 1 ? args[1] : ".*";
45 | File parent = new File(outputFile).getParentFile();
46 | if (!parent.exists()) {
47 | System.out.println("No parent directory [" + parent.toString()
48 | + "] found. Will not generate the configuration properties file");
49 | return;
50 | }
51 | new Generator().generate(outputFile, inclusionPattern);
52 | }
53 |
54 | static class Generator {
55 |
56 | void generate(String outputFile, String inclusionPattern) {
57 | try {
58 | System.out.println("Parsing all configuration metadata");
59 | Resource[] resources = getResources();
60 | System.out.println("Found [" + resources.length + "] configuration metadata jsons");
61 | TreeSet names = new TreeSet<>();
62 | Map descriptions = new HashMap<>();
63 | final AtomicInteger count = new AtomicInteger();
64 | final AtomicInteger matchingPropertyCount = new AtomicInteger();
65 | final AtomicInteger propertyCount = new AtomicInteger();
66 | Pattern pattern = Pattern.compile(inclusionPattern);
67 | for (Resource resource : resources) {
68 | if (resourceNameContainsPattern(resource)) {
69 | count.incrementAndGet();
70 | byte[] bytes = StreamUtils.copyToByteArray(resource.getInputStream());
71 | Map response = new ObjectMapper().readValue(bytes, HashMap.class);
72 | List