64.32e36797.js 31.8 KB
Newer Older
茶陵後's avatar
茶陵後 已提交
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[64],{491:function(e,t,o){"use strict";o.r(t);var n=o(56),s=Object(n.a)({},(function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("ContentSlotsDistributor",{attrs:{"slot-key":e.$parent.slotKey}},[o("h1",{attrs:{id:"spring-cloud-build"}},[o("a",{staticClass:"header-anchor",attrs:{href:"#spring-cloud-build"}},[e._v("#")]),e._v(" Spring Cloud Build")]),e._v(" "),o("h2",{attrs:{id:"building-and-deploying"}},[o("a",{staticClass:"header-anchor",attrs:{href:"#building-and-deploying"}},[e._v("#")]),e._v(" "),o("a",{attrs:{href:"#_building_and_deploying"}},[e._v("Building and Deploying")])]),e._v(" "),o("p",[e._v("To install locally:")]),e._v(" "),o("div",{staticClass:"language- extra-class"},[o("pre",{pre:!0,attrs:{class:"language-text"}},[o("code",[e._v("$ mvn install -s .settings.xml\n")])])]),o("p",[e._v("and to deploy snapshots to repo.spring.io:")]),e._v(" "),o("div",{staticClass:"language- extra-class"},[o("pre",{pre:!0,attrs:{class:"language-text"}},[o("code",[e._v("$ mvn deploy -DaltSnapshotDeploymentRepository=repo.spring.io::default::https://repo.spring.io/snapshot\n")])])]),o("p",[e._v("for a RELEASE build use")]),e._v(" "),o("div",{staticClass:"language- extra-class"},[o("pre",{pre:!0,attrs:{class:"language-text"}},[o("code",[e._v("$ mvn deploy -DaltReleaseDeploymentRepository=repo.spring.io::default::https://repo.spring.io/release\n")])])]),o("p",[e._v("and for jcenter use")]),e._v(" "),o("div",{staticClass:"language- extra-class"},[o("pre",{pre:!0,attrs:{class:"language-text"}},[o("code",[e._v("$ mvn deploy -DaltReleaseDeploymentRepository=bintray::default::https://api.bintray.com/maven/spring/jars/org.springframework.cloud:build\n")])])]),o("p",[e._v("and for Maven Central use")]),e._v(" "),o("div",{staticClass:"language- extra-class"},[o("pre",{pre:!0,attrs:{class:"language-text"}},[o("code",[e._v("$ mvn deploy -P central -DaltReleaseDeploymentRepository=sonatype-nexus-staging::default::https://oss.sonatype.org/service/local/staging/deploy/maven2\n")])])]),o("p",[e._v('(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).')]),e._v(" "),o("h2",{attrs:{id:"contributing"}},[o("a",{staticClass:"header-anchor",attrs:{href:"#contributing"}},[e._v("#")]),e._v(" "),o("a",{attrs:{href:"#_contributing"}},[e._v("Contributing")])]),e._v(" "),o("p",[e._v("Spring Cloud is released under the non-restrictive Apache 2.0 license,\nand follows a very standard Github development process, using Github\ntracker for issues and merging pull requests into master. If you want\nto contribute even something trivial please do not hesitate, but\nfollow the guidelines below.")]),e._v(" "),o("h3",{attrs:{id:"sign-the-contributor-license-agreement"}},[o("a",{staticClass:"header-anchor",attrs:{href:"#sign-the-contributor-license-agreement"}},[e._v("#")]),e._v(" "),o("a",{attrs:{href:"#_sign_the_contributor_license_agreement"}},[e._v("Sign the Contributor License Agreement")])]),e._v(" "),o("p",[e._v("Before we accept a non-trivial patch or pull request we will need you to sign the"),o("a",{attrs:{href:"https://cla.pivotal.io/sign/spring",target:"_blank",rel:"noopener noreferrer"}},[e._v("Contributor License Agreement"),o("OutboundLink")],1),e._v(".\nSigning the contributor’s agreement does not grant anyone commit rights to the main\nrepository, but it does mean that we can accept your contributions, and you will get an\nauthor credit if we do. Active contributors might be asked to join the core team, and\ngiven the ability to merge pull requests.")]),e._v(" "),o("h3",{attrs:{id:"code-of-conduct"}},[o("a",{staticClass:"header-anchor",attrs:{href:"#code-of-conduct"}},[e._v("#")]),e._v(" "),o("a",{attrs:{href:"#_code_of_conduct"}},[e._v("Code of Conduct")])]),e._v(" "),o("p",[e._v("This project adheres to the Contributor Covenant "),o("a",{attrs:{href:"https://github.com/spring-cloud/spring-cloud-build/blob/master/docs/src/main/asciidoc/code-of-conduct.adoc",target:"_blank",rel:"noopener noreferrer"}},[e._v("code of\nconduct"),o("OutboundLink")],1),e._v(". By participating, you are expected to uphold this code. Please report\nunacceptable behavior to "),o("a",{attrs:{href:"/cdn-cgi/l/email-protection#dba8aba9b2b5bcf6b8b4bfbef6b4bdf6b8b4b5bfaeb8af9babb2adb4afbab7f5b2b4"}},[e._v("[email protected]")]),e._v(".")]),e._v(" "),o("h3",{attrs:{id:"code-conventions-and-housekeeping"}},[o("a",{staticClass:"header-anchor",attrs:{href:"#code-conventions-and-housekeeping"}},[e._v("#")]),e._v(" "),o("a",{attrs:{href:"#_code_conventions_and_housekeeping"}},[e._v("Code Conventions and Housekeeping")])]),e._v(" "),o("p",[e._v("None of these is essential for a pull request, but they will all help. They can also be\nadded after the original pull request but before a merge.")]),e._v(" "),o("ul",[o("li",[o("p",[e._v("Use the Spring Framework code format conventions. If you use Eclipse\nyou can import formatter settings using the"),o("code",[e._v("eclipse-code-formatter.xml")]),e._v(" file from the"),o("a",{attrs:{href:"https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-dependencies-parent/eclipse-code-formatter.xml",target:"_blank",rel:"noopener noreferrer"}},[e._v("Spring\nCloud Build"),o("OutboundLink")],1),e._v(" project. If using IntelliJ, you can use the"),o("a",{attrs:{href:"https://plugins.jetbrains.com/plugin/6546",target:"_blank",rel:"noopener noreferrer"}},[e._v("Eclipse Code Formatter\nPlugin"),o("OutboundLink")],1),e._v(" to import the same file.")])]),e._v(" "),o("li",[o("p",[e._v("Make sure all new "),o("code",[e._v(".java")]),e._v(" files to have a simple Javadoc class comment with at least an"),o("code",[e._v("@author")]),e._v(" tag identifying you, and preferably at least a paragraph on what the class is\nfor.")])]),e._v(" "),o("li",[o("p",[e._v("Add the ASF license header comment to all new "),o("code",[e._v(".java")]),e._v(" files (copy from existing files\nin the project)")])]),e._v(" "),o("li",[o("p",[e._v("Add yourself as an "),o("code",[e._v("@author")]),e._v(" to the .java files that you modify substantially (more\nthan cosmetic changes).")])]),e._v(" "),o("li",[o("p",[e._v("Add some Javadocs and, if you change the namespace, some XSD doc elements.")])]),e._v(" "),o("li",[o("p",[e._v("A few unit tests would help a lot as well — someone has to do it.")])]),e._v(" "),o("li",[o("p",[e._v("If no-one else is using your branch, please rebase it against the current master (or\nother target branch in the main project).")])]),e._v(" "),o("li",[o("p",[e._v("When writing a commit message please follow "),o("a",{attrs:{href:"https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html",target:"_blank",rel:"noopener noreferrer"}},[e._v("these conventions"),o("OutboundLink")],1),e._v(",\nif you are fixing an existing issue please add "),o("code",[e._v("Fixes gh-XXXX")]),e._v(" at the end of the commit\nmessage (where XXXX is the issue number).")])])]),e._v(" "),o("h3",{attrs:{id:"checkstyle"}},[o("a",{staticClass:"header-anchor",attrs:{href:"#checkstyle"}},[e._v("#")]),e._v(" "),o("a",{attrs:{href:"#_checkstyle"}},[e._v("Checkstyle")])]),e._v(" "),o("p",[e._v("Spring Cloud Build comes with a set of checkstyle rules. You can find them in the "),o("code",[e._v("spring-cloud-build-tools")]),e._v(" module. The most notable files under the module are:")]),e._v(" "),o("p",[e._v("spring-cloud-build-tools/")]),e._v(" "),o("div",{staticClass:"language- extra-class"},[o("pre",{pre:!0,attrs:{class:"language-text"}},[o("code",[e._v("└── src\n    ├── checkstyle\n    │   └── checkstyle-suppressions.xml (3)\n    └── main\n        └── resources\n            ├── checkstyle-header.txt (2)\n            └── checkstyle.xml (1)\n")])])]),o("table",[o("thead",[o("tr",[o("th",[o("strong",[e._v("1")])]),e._v(" "),o("th",[e._v("Default Checkstyle rules")])])]),e._v(" "),o("tbody",[o("tr",[o("td",[o("strong",[e._v("2")])]),e._v(" "),o("td",[e._v("File header setup")])]),e._v(" "),o("tr",[o("td",[o("strong",[e._v("3")])]),e._v(" "),o("td",[e._v("Default suppression rules")])])])]),e._v(" "),o("h4",{attrs:{id:"checkstyle-configuration"}},[o("a",{staticClass:"header-anchor",attrs:{href:"#checkstyle-configuration"}},[e._v("#")]),e._v(" "),o("a",{attrs:{href:"#_checkstyle_configuration"}},[e._v("Checkstyle configuration")])]),e._v(" "),o("p",[e._v("Checkstyle rules are "),o("strong",[e._v("disabled by default")]),e._v(". To add checkstyle to your project just define the following properties and plugins.")]),e._v(" "),o("p",[e._v("pom.xml")]),e._v(" "),o("div",{staticClass:"language- extra-class"},[o("pre",{pre:!0,attrs:{class:"language-text"}},[o("code",[e._v("<properties>\n<maven-checkstyle-plugin.failsOnError>true</maven-checkstyle-plugin.failsOnError> (1)\n        <maven-checkstyle-plugin.failsOnViolation>true\n        </maven-checkstyle-plugin.failsOnViolation> (2)\n        <maven-checkstyle-plugin.includeTestSourceDirectory>true\n        </maven-checkstyle-plugin.includeTestSourceDirectory> (3)\n</properties>\n\n<build>\n        <plugins>\n            <plugin> (4)\n                <groupId>io.spring.javaformat</groupId>\n                <artifactId>spring-javaformat-maven-plugin</artifactId>\n            </plugin>\n            <plugin> (5)\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-checkstyle-plugin</artifactId>\n            </plugin>\n        </plugins>\n\n    <reporting>\n        <plugins>\n            <plugin> (5)\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-checkstyle-plugin</artifactId>\n            </plugin>\n        </plugins>\n    </reporting>\n</build>\n")])])]),o("table",[o("thead",[o("tr",[o("th",[o("strong",[e._v("1")])]),e._v(" "),o("th",[e._v("Fails the build upon Checkstyle errors")])])]),e._v(" "),o("tbody",[o("tr",[o("td",[o("strong",[e._v("2")])]),e._v(" "),o("td",[e._v("Fails the build upon Checkstyle violations")])]),e._v(" "),o("tr",[o("td",[o("strong",[e._v("3")])]),e._v(" "),o("td",[e._v("Checkstyle analyzes also the test sources")])]),e._v(" "),o("tr",[o("td",[o("strong",[e._v("4")])]),e._v(" "),o("td",[e._v("Add the Spring Java Format plugin that will reformat your code to pass most of the Checkstyle formatting rules")])]),e._v(" "),o("tr",[o("td",[o("strong",[e._v("5")])]),e._v(" "),o("td",[e._v("Add checkstyle plugin to your build and reporting phases")])])])]),e._v(" "),o("p",[e._v("If you need to suppress some rules (e.g. line length needs to be longer), then it’s enough for you to define a file under "),o("code",[e._v("${project.root}/src/checkstyle/checkstyle-suppressions.xml")]),e._v(" with your suppressions. Example:")]),e._v(" "),o("p",[e._v("projectRoot/src/checkstyle/checkstyle-suppresions.xml")]),e._v(" "),o("div",{staticClass:"language- extra-class"},[o("pre",{pre:!0,attrs:{class:"language-text"}},[o("code",[e._v('<?xml version="1.0"?>\n<!DOCTYPE suppressions PUBLIC\n\t\t"-//Puppy Crawl//DTD Suppressions 1.1//EN"\n\t\t"https://www.puppycrawl.com/dtds/suppressions_1_1.dtd">\n<suppressions>\n\t<suppress files=".*ConfigServerApplication\\.java" checks="HideUtilityClassConstructor"/>\n\t<suppress files=".*ConfigClientWatch\\.java" checks="LineLengthCheck"/>\n</suppressions>\n')])])]),o("p",[e._v("It’s advisable to copy the "),o("code",[e._v("${spring-cloud-build.rootFolder}/.editorconfig")]),e._v(" and "),o("code",[e._v("${spring-cloud-build.rootFolder}/.springformat")]),e._v(" to your project. That way, some default formatting rules will be applied. You can do so by running this script:")]),e._v(" "),o("div",{staticClass:"language- extra-class"},[o("pre",{pre:!0,attrs:{class:"language-text"}},[o("code",[e._v("$ curl https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/.editorconfig -o .editorconfig\n$ touch .springformat\n")])])]),o("h3",{attrs:{id:"ide-setup"}},[o("a",{staticClass:"header-anchor",attrs:{href:"#ide-setup"}},[e._v("#")]),e._v(" "),o("a",{attrs:{href:"#_ide_setup"}},[e._v("IDE setup")])]),e._v(" "),o("h4",{attrs:{id:"intellij-idea"}},[o("a",{staticClass:"header-anchor",attrs:{href:"#intellij-idea"}},[e._v("#")]),e._v(" "),o("a",{attrs:{href:"#_intellij_idea"}},[e._v("Intellij IDEA")])]),e._v(" "),o("p",[e._v("In order to setup Intellij you should import our coding conventions, inspection profiles and set up the checkstyle plugin.\nThe following files can be found in the "),o("a",{attrs:{href:"https://github.com/spring-cloud/spring-cloud-build/tree/master/spring-cloud-build-tools",target:"_blank",rel:"noopener noreferrer"}},[e._v("Spring Cloud Build"),o("OutboundLink")],1),e._v(" project.")]),e._v(" "),o("p",[e._v("spring-cloud-build-tools/")]),e._v(" "),o("div",{staticClass:"language- extra-class"},[o("pre",{pre:!0,attrs:{class:"language-text"}},[o("code",[e._v("└── src\n    ├── checkstyle\n    │   └── checkstyle-suppressions.xml (3)\n    └── main\n        └── resources\n            ├── checkstyle-header.txt (2)\n            ├── checkstyle.xml (1)\n            └── intellij\n                ├── Intellij_Project_Defaults.xml (4)\n                └── Intellij_Spring_Boot_Java_Conventions.xml (5)\n")])])]),o("table",[o("thead",[o("tr",[o("th",[o("strong",[e._v("1")])]),e._v(" "),o("th",[e._v("Default Checkstyle rules")])])]),e._v(" "),o("tbody",[o("tr",[o("td",[o("strong",[e._v("2")])]),e._v(" "),o("td",[e._v("File header setup")])]),e._v(" "),o("tr",[o("td",[o("strong",[e._v("3")])]),e._v(" "),o("td",[e._v("Default suppression rules")])]),e._v(" "),o("tr",[o("td",[o("strong",[e._v("4")])]),e._v(" "),o("td",[e._v("Project defaults for Intellij that apply most of Checkstyle rules")])]),e._v(" "),o("tr",[o("td",[o("strong",[e._v("5")])]),e._v(" "),o("td",[e._v("Project style conventions for Intellij that apply most of Checkstyle rules")])])])]),e._v(" "),o("p",[o("img",{attrs:{src:"https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/images/intellij-code-style.png",alt:"Code style"}})]),e._v(" "),o("p",[e._v("Figure 1. Code style")]),e._v(" "),o("p",[e._v("Go to "),o("code",[e._v("File")]),e._v(""),o("code",[e._v("Settings")]),e._v(""),o("code",[e._v("Editor")]),e._v(""),o("code",[e._v("Code style")]),e._v(". There click on the icon next to the "),o("code",[e._v("Scheme")]),e._v(" section. There, click on the "),o("code",[e._v("Import Scheme")]),e._v(" value and pick the "),o("code",[e._v("Intellij IDEA code style XML")]),e._v(" option. Import the "),o("code",[e._v("spring-cloud-build-tools/src/main/resources/intellij/Intellij_Spring_Boot_Java_Conventions.xml")]),e._v(" file.")]),e._v(" "),o("p",[o("img",{attrs:{src:"https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/images/intellij-inspections.png",alt:"Code style"}})]),e._v(" "),o("p",[e._v("Figure 2. Inspection profiles")]),e._v(" "),o("p",[e._v("Go to "),o("code",[e._v("File")]),e._v(""),o("code",[e._v("Settings")]),e._v(""),o("code",[e._v("Editor")]),e._v(""),o("code",[e._v("Inspections")]),e._v(". There click on the icon next to the "),o("code",[e._v("Profile")]),e._v(" section. There, click on the "),o("code",[e._v("Import Profile")]),e._v(" and import the "),o("code",[e._v("spring-cloud-build-tools/src/main/resources/intellij/Intellij_Project_Defaults.xml")]),e._v(" file.")]),e._v(" "),o("p",[e._v("Checkstyle")]),e._v(" "),o("p",[e._v("To have Intellij work with Checkstyle, you have to install the "),o("code",[e._v("Checkstyle")]),e._v(" plugin. It’s advisable to also install the "),o("code",[e._v("Assertions2Assertj")]),e._v(" to automatically convert the JUnit assertions")]),e._v(" "),o("p",[o("img",{attrs:{src:"https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/images/intellij-checkstyle.png",alt:"Checkstyle"}})]),e._v(" "),o("p",[e._v("Go to "),o("code",[e._v("File")]),e._v(""),o("code",[e._v("Settings")]),e._v(""),o("code",[e._v("Other settings")]),e._v(""),o("code",[e._v("Checkstyle")]),e._v(". There click on the "),o("code",[e._v("+")]),e._v(" icon in the "),o("code",[e._v("Configuration file")]),e._v(" section. There, you’ll have to define where the checkstyle rules should be picked from. In the image above, we’ve picked the rules from the cloned Spring Cloud Build repository. However, you can point to the Spring Cloud Build’s GitHub repository (e.g. for the "),o("code",[e._v("checkstyle.xml")]),e._v(" : "),o("code",[e._v("[https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/main/resources/checkstyle.xml](https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/main/resources/checkstyle.xml)")]),e._v("). We need to provide the following variables:")]),e._v(" "),o("ul",[o("li",[o("p",[o("code",[e._v("checkstyle.header.file")]),e._v(" - please point it to the Spring Cloud Build’s, "),o("code",[e._v("spring-cloud-build-tools/src/main/resources/checkstyle-header.txt")]),e._v(" file either in your cloned repo or via the "),o("code",[e._v("[https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/main/resources/checkstyle-header.txt](https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/main/resources/checkstyle-header.txt)")]),e._v(" URL.")])]),e._v(" "),o("li",[o("p",[o("code",[e._v("checkstyle.suppressions.file")]),e._v(" - default suppressions. Please point it to the Spring Cloud Build’s, "),o("code",[e._v("spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml")]),e._v(" file either in your cloned repo or via the "),o("code",[e._v("[https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml](https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml)")]),e._v(" URL.")])]),e._v(" "),o("li",[o("p",[o("code",[e._v("checkstyle.additional.suppressions.file")]),e._v(" - this variable corresponds to suppressions in your local project. E.g. you’re working on "),o("code",[e._v("spring-cloud-contract")]),e._v(". Then point to the "),o("code",[e._v("project-root/src/checkstyle/checkstyle-suppressions.xml")]),e._v(" folder. Example for "),o("code",[e._v("spring-cloud-contract")]),e._v(" would be: "),o("code",[e._v("/home/username/spring-cloud-contract/src/checkstyle/checkstyle-suppressions.xml")]),e._v(".")])])]),e._v(" "),o("table",[o("thead",[o("tr",[o("th"),e._v(" "),o("th",[e._v("Remember to set the "),o("code",[e._v("Scan Scope")]),e._v(" to "),o("code",[e._v("All sources")]),e._v(" since we apply checkstyle rules for production and test sources.")])])]),e._v(" "),o("tbody")]),e._v(" "),o("h3",{attrs:{id:"duplicate-finder"}},[o("a",{staticClass:"header-anchor",attrs:{href:"#duplicate-finder"}},[e._v("#")]),e._v(" "),o("a",{attrs:{href:"#_duplicate_finder"}},[e._v("Duplicate Finder")])]),e._v(" "),o("p",[e._v("Spring Cloud Build brings along the "),o("code",[e._v("basepom:duplicate-finder-maven-plugin")]),e._v(", that enables flagging duplicate and conflicting classes and resources on the java classpath.")]),e._v(" "),o("h4",{attrs:{id:"duplicate-finder-configuration"}},[o("a",{staticClass:"header-anchor",attrs:{href:"#duplicate-finder-configuration"}},[e._v("#")]),e._v(" "),o("a",{attrs:{href:"#_duplicate_finder_configuration"}},[e._v("Duplicate Finder configuration")])]),e._v(" "),o("p",[e._v("Duplicate finder is "),o("strong",[e._v("enabled by default")]),e._v(" and will run in the "),o("code",[e._v("verify")]),e._v(" phase of your Maven build, but it will only take effect in your project if you add the "),o("code",[e._v("duplicate-finder-maven-plugin")]),e._v(" to the "),o("code",[e._v("build")]),e._v(" section of the projecst’s "),o("code",[e._v("pom.xml")]),e._v(".")]),e._v(" "),o("p",[e._v("pom.xml")]),e._v(" "),o("div",{staticClass:"language- extra-class"},[o("pre",{pre:!0,attrs:{class:"language-text"}},[o("code",[e._v("<build>\n    <plugins>\n        <plugin>\n            <groupId>org.basepom.maven</groupId>\n            <artifactId>duplicate-finder-maven-plugin</artifactId>\n        </plugin>\n    </plugins>\n</build>\n")])])]),o("p",[e._v("For other properties, we have set defaults as listed in the "),o("a",{attrs:{href:"https://github.com/basepom/duplicate-finder-maven-plugin/wiki",target:"_blank",rel:"noopener noreferrer"}},[e._v("plugin documentation"),o("OutboundLink")],1),e._v(".")]),e._v(" "),o("p",[e._v("You can easily override them but setting the value of the selected property prefixed with "),o("code",[e._v("duplicate-finder-maven-plugin")]),e._v(". For example, set "),o("code",[e._v("duplicate-finder-maven-plugin.skip")]),e._v(" to "),o("code",[e._v("true")]),e._v(" in order to skip duplicates check in your build.")]),e._v(" "),o("p",[e._v("If you need to add "),o("code",[e._v("ignoredClassPatterns")]),e._v(" or "),o("code",[e._v("ignoredResourcePatterns")]),e._v(" to your setup, make sure to add them in the plugin configuration section of your project:")]),e._v(" "),o("div",{staticClass:"language- extra-class"},[o("pre",{pre:!0,attrs:{class:"language-text"}},[o("code",[e._v("<build>\n    <plugins>\n        <plugin>\n            <groupId>org.basepom.maven</groupId>\n            <artifactId>duplicate-finder-maven-plugin</artifactId>\n            <configuration>\n                <ignoredClassPatterns>\n\t\t\t\t    <ignoredClassPattern>org.joda.time.base.BaseDateTime</ignoredClassPattern>\n\t\t\t\t\t<ignoredClassPattern>.*module-info</ignoredClassPattern>\n\t\t\t\t</ignoredClassPatterns>\n                <ignoredResourcePatterns>\n                    <ignoredResourcePattern>changelog.txt</ignoredResourcePattern>\n                </ignoredResourcePatterns>\n            </configuration>\n        </plugin>\n    </plugins>\n</build>\n")])])]),o("h2",{attrs:{id:"flattening-the-poms"}},[o("a",{staticClass:"header-anchor",attrs:{href:"#flattening-the-poms"}},[e._v("#")]),e._v(" "),o("a",{attrs:{href:"#_flattening_the_poms"}},[e._v("Flattening the POMs")])]),e._v(" "),o("p",[e._v('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.')]),e._v(" "),o("p",[e._v("In order to add it, add the "),o("code",[e._v("org.codehaus.mojo:flatten-maven-plugin")]),e._v(" to your "),o("code",[e._v("pom.xml")]),e._v(".")]),e._v(" "),o("div",{staticClass:"language- extra-class"},[o("pre",{pre:!0,attrs:{class:"language-text"}},[o("code",[e._v("<build>\n\t<plugins>\n\t\t<plugin>\n\t\t\t<groupId>org.codehaus.mojo</groupId>\n\t\t\t<artifactId>flatten-maven-plugin</artifactId>\n\t\t</plugin>\n\t</plugins>\n</build>\n")])])]),o("h2",{attrs:{id:"reusing-the-documentation"}},[o("a",{staticClass:"header-anchor",attrs:{href:"#reusing-the-documentation"}},[e._v("#")]),e._v(" "),o("a",{attrs:{href:"#_reusing_the_documentation"}},[e._v("Reusing the documentation")])]),e._v(" "),o("p",[e._v("Spring Cloud Build publishes its "),o("code",[e._v("spring-cloud-build-docs")]),e._v(" module that contains\nhelpful scripts (e.g. README generation ruby script) and css, xslt and images\nfor the Spring Cloud documentation. If you want to follow the same convention\napproach of generating documentation just add these plugins to your "),o("code",[e._v("docs")]),e._v(" module")]),e._v(" "),o("div",{staticClass:"language- extra-class"},[o("pre",{pre:!0,attrs:{class:"language-text"}},[o("code",[e._v("<properties>\n\t<upload-docs-zip.phase>deploy</upload-docs-zip.phase> (8)\n</properties>\n<profiles>\n\t<profile>\n\t\t<id>docs</id>\n\t\t<build>\n\t\t\t<plugins>\n\t\t\t\t<plugin>\n\t\t\t\t\t<groupId>pl.project13.maven</groupId>\n\t\t\t\t\t<artifactId>git-commit-id-plugin</artifactId> (1)\n\t\t\t\t</plugin>\n\t\t\t\t<plugin>\n\t\t\t\t\t<groupId>org.apache.maven.plugins</groupId>\n\t\t\t\t\t<artifactId>maven-dependency-plugin</artifactId> (2)\n\t\t\t\t</plugin>\n\t\t\t\t<plugin>\n\t\t\t\t\t<groupId>org.apache.maven.plugins</groupId>\n\t\t\t\t\t<artifactId>maven-resources-plugin</artifactId> (3)\n\t\t\t\t</plugin>\n\t\t\t\t<plugin>\n\t\t\t\t\t<groupId>org.codehaus.mojo</groupId>\n\t\t\t\t\t<artifactId>exec-maven-plugin</artifactId> (4)\n\t\t\t\t</plugin>\n\t\t\t\t<plugin>\n\t\t\t\t\t<groupId>org.asciidoctor</groupId>\n\t\t\t\t\t<artifactId>asciidoctor-maven-plugin</artifactId> (5)\n\t\t\t\t</plugin>\n\t\t\t\t<plugin>\n\t\t\t\t\t<groupId>org.apache.maven.plugins</groupId>\n\t\t\t\t\t<artifactId>maven-antrun-plugin</artifactId> (6)\n\t\t\t\t</plugin>\n\t\t\t\t<plugin>\n\t\t\t\t\t<artifactId>maven-deploy-plugin</artifactId> (7)\n\t\t\t\t</plugin>\n\t\t\t</plugins>\n\t\t</build>\n\t</profile>\n</profiles>\n")])])]),o("table",[o("thead",[o("tr",[o("th",[o("strong",[e._v("1")])]),e._v(" "),o("th",[e._v("This plugin downloads sets up all the git information of the project")])])]),e._v(" "),o("tbody",[o("tr",[o("td",[o("strong",[e._v("2")])]),e._v(" "),o("td",[e._v("This plugin downloads the resources of the "),o("code",[e._v("spring-cloud-build-docs")]),e._v(" module")])]),e._v(" "),o("tr",[o("td",[o("strong",[e._v("3")])]),e._v(" "),o("td",[e._v("This plugin unpacks the resources of the "),o("code",[e._v("spring-cloud-build-docs")]),e._v(" module")])]),e._v(" "),o("tr",[o("td",[o("strong",[e._v("4")])]),e._v(" "),o("td",[e._v("This plugin generates an "),o("code",[e._v("adoc")]),e._v(" file with all the configuration properties from the classpath")])]),e._v(" "),o("tr",[o("td",[o("strong",[e._v("5")])]),e._v(" "),o("td",[e._v("This plugin is required to parse the Asciidoctor documentation")])]),e._v(" "),o("tr",[o("td",[o("strong",[e._v("6")])]),e._v(" "),o("td",[e._v("This plugin is required to copy resources into proper final destinations and to generate main README.adoc and to assert that no files use unresolved links")])]),e._v(" "),o("tr",[o("td",[o("strong",[e._v("7")])]),e._v(" "),o("td",[e._v("This plugin ensures that the generated zip docs will get published")])]),e._v(" "),o("tr",[o("td",[o("strong",[e._v("8")])]),e._v(" "),o("td",[e._v('This property turns on the "deploy" phase for <7>')])])])]),e._v(" "),o("table",[o("thead",[o("tr",[o("th"),e._v(" "),o("th",[e._v("The order of plugin declaration is important!")])])]),e._v(" "),o("tbody")]),e._v(" "),o("p",[e._v("In order for the build to generate the "),o("code",[e._v("adoc")]),e._v(" file with all your configuration properties, your "),o("code",[e._v("docs")]),e._v(" module should contain all the dependencies on the classpath, that you would want to scan for configuration properties. The file will be output to "),o("code",[e._v("${docsModule}/src/main/asciidoc/_configprops.adoc")]),e._v(" file (configurable via the "),o("code",[e._v("configprops.path")]),e._v(" property).")]),e._v(" "),o("p",[e._v("If you want to modify which of the configuration properties are put in the table, you can tweak the "),o("code",[e._v("configprops.inclusionPattern")]),e._v(" pattern to include only a subset of the properties (e.g. "),o("code",[e._v("<configprops.inclusionPattern>spring.sleuth.*</configprops.inclusionPattern>")]),e._v(").")]),e._v(" "),o("p",[e._v("Spring Cloud Build Docs comes with a set of attributes for asciidoctor that you can reuse.")]),e._v(" "),o("div",{staticClass:"language- extra-class"},[o("pre",{pre:!0,attrs:{class:"language-text"}},[o("code",[e._v("<attributes>\n\t<docinfo>shared</docinfo>\n\t<allow-uri-read>true</allow-uri-read>\n\t<nofooter/>\n\t<toc>left</toc>\n\t<toc-levels>4</toc-levels>\n\t<sectlinks>true</sectlinks>\n\t<sources-root>${project.basedir}/[email protected]</sources-root>\n\t<asciidoc-sources-root>${project.basedir}/src/main/[email protected]</asciidoc-sources-root>\n\t<generated-resources-root>${project.basedir}/target/[email protected]\n\t</generated-resources-root>\n\t\x3c!-- Use this attribute the reference code from another module --\x3e\n\t\x3c!-- Note the @ at the end, lowering the precedence of the attribute --\x3e\n\t<project-root>${maven.multiModuleProjectDirectory}@</project-root>\n\t\x3c!-- It's mandatory for you to pass the docs.main property --\x3e\n\t<github-repo>${docs.main}@</github-repo>\n\t<github-project>https://github.com/spring-cloud/${docs.main}@</github-project>\n\t<github-raw>\n\t\thttps://raw.githubusercontent.com/spring-cloud/${docs.main}/${github-tag}@\n\t</github-raw>\n\t<github-code>https://github.com/spring-cloud/${docs.main}/tree/${github-tag}@\n\t</github-code>\n\t<github-issues>https://github.com/spring-cloud/${docs.main}/issues/@</github-issues>\n\t<github-wiki>https://github.com/spring-cloud/${docs.main}/[email protected]</github-wiki>\n\t<github-master-code>https://github.com/spring-cloud/${docs.main}/tree/[email protected]\n\t</github-master-code>\n\t<index-link>${index-link}@</index-link>\n\n\t\x3c!-- Spring Cloud specific --\x3e\n\t\x3c!-- for backward compatibility --\x3e\n\t<spring-cloud-version>${project.version}@</spring-cloud-version>\n\t<project-version>${project.version}@</project-version>\n\t<github-tag>${github-tag}@</github-tag>\n\t<version-type>${version-type}@</version-type>\n\t<docs-url>https://docs.spring.io/${docs.main}/docs/${project.version}@</docs-url>\n\t<raw-docs-url>${github-raw}@</raw-docs-url>\n\t<project-version>${project.version}@</project-version>\n\t<project-name>${docs.main}@</project-name>\n</attributes>\n")])])]),o("h2",{attrs:{id:"updating-the-guides"}},[o("a",{staticClass:"header-anchor",attrs:{href:"#updating-the-guides"}},[e._v("#")]),e._v(" "),o("a",{attrs:{href:"#_updating_the_guides"}},[e._v("Updating the guides")])]),e._v(" "),o("p",[e._v("We assume that your project contains guides under the "),o("code",[e._v("guides")]),e._v(" folder.")]),e._v(" "),o("div",{staticClass:"language- extra-class"},[o("pre",{pre:!0,attrs:{class:"language-text"}},[o("code",[e._v(".\n└── guides\n\t├── gs-guide1\n\t├── gs-guide2\n\t└── gs-guide3\n")])])]),o("p",[e._v("This means that the project contains 3 guides that would\ncorrespond to the following guides in Spring Guides org.")]),e._v(" "),o("ul",[o("li",[o("p",[o("a",{attrs:{href:"https://github.com/spring-guides/gs-guide1",target:"_blank",rel:"noopener noreferrer"}},[e._v("https://github.com/spring-guides/gs-guide1"),o("OutboundLink")],1)])]),e._v(" "),o("li",[o("p",[o("a",{attrs:{href:"https://github.com/spring-guides/gs-guide2",target:"_blank",rel:"noopener noreferrer"}},[e._v("https://github.com/spring-guides/gs-guide2"),o("OutboundLink")],1)])]),e._v(" "),o("li",[o("p",[o("a",{attrs:{href:"https://github.com/spring-guides/gs-guide3",target:"_blank",rel:"noopener noreferrer"}},[e._v("https://github.com/spring-guides/gs-guide3"),o("OutboundLink")],1)])])]),e._v(" "),o("p",[e._v("If you deploy your project with the "),o("code",[e._v("-Pguides")]),e._v(" profile like this")]),e._v(" "),o("div",{staticClass:"language- extra-class"},[o("pre",{pre:!0,attrs:{class:"language-text"}},[o("code",[e._v("$ ./mvnw clean deploy -Pguides\n")])])]),o("p",[e._v("what will happen is that for GA project versions, we will clone "),o("code",[e._v("gs-guide1")]),e._v(", "),o("code",[e._v("gs-guide2")]),e._v(" and "),o("code",[e._v("gs-guide3")]),e._v(" and update their contents with the ones being under your "),o("code",[e._v("guides")]),e._v(" project.")]),e._v(" "),o("p",[e._v("You can skip this by either not adding the "),o("code",[e._v("guides")]),e._v(" profile, or passing the "),o("code",[e._v("-DskipGuides")]),e._v(" system property when the profile is turned on.")]),e._v(" "),o("p",[e._v("You can configure the project version passed to guides via the "),o("code",[e._v("guides-project.version")]),e._v(" (defaults to "),o("code",[e._v("${project.version}")]),e._v("). The phase at which guides get updated can be configured by "),o("code",[e._v("guides-update.phase")]),e._v(" (defaults to "),o("code",[e._v("deploy")]),e._v(").")])])}),[],!1,null,null,null);t.default=s.exports}}]);