<p><ahref="https://pivotal.io/platform-as-a-service/migrating-to-cloud-native-application-architectures-ebook">Cloud Native</a> is a style of application development that encourages easy adoption of best practices in the areas of continuous delivery and value-driven development.
A related discipline is that of building <ahref="https://12factor.net/">12-factor Applications</a>, in which development practices are aligned with delivery and operations goals — for instance, by using declarative programming and management and monitoring.
Spring Cloud facilitates these styles of development in a number of specific ways.
The starting point is a set of features to which all components in a distributed system need easy access.</p>
</div>
<divclass="paragraph">
<p>Many of those features are covered by <ahref="https://projects.spring.io/spring-boot">Spring Boot</a>, on which Spring Cloud builds. Some more features are delivered by Spring Cloud as two libraries: Spring Cloud Context and Spring Cloud Commons.
Spring Cloud Context provides utilities and special services for the <code>ApplicationContext</code> of a Spring Cloud application (bootstrap context, encryption, refresh scope, and environment endpoints). Spring Cloud Commons is a set of abstractions and common classes used in different Spring Cloud implementations (such as Spring Cloud Netflix and Spring Cloud Consul).</p>
</div>
<divclass="paragraph">
<p>If you get an exception due to "Illegal key size" and you use Sun’s JDK, you need to install the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files.
<h4id="_importing_into_eclipse_with_m2eclipse"><aclass="link"href="#_importing_into_eclipse_with_m2eclipse">Importing into eclipse with m2eclipse</a></h4>
<divclass="paragraph">
<p>We recommend the <ahref="https://eclipse.org/m2e/">m2eclipse</a> eclipse plugin when working with
eclipse. If you don’t already have m2eclipse installed it is available from the "eclipse
marketplace".</p>
</div>
<divclass="admonitionblock note">
<table>
<tr>
<tdclass="icon">
<iclass="fa icon-note"title="Note"></i>
</td>
<tdclass="content">
Older versions of m2e do not support Maven 3.3, so once the
projects are imported into Eclipse you will also need to tell
m2eclipse to use the right profile for the projects. If you
see many different errors related to the POMs in the projects, check
that you have an up to date installation. If you can’t upgrade m2e,
add the "spring" profile to your <code>settings.xml</code>. Alternatively you can
copy the repository settings from the "spring" profile of the parent
pom into your <code>settings.xml</code>.
</td>
</tr>
</table>
</div>
</div>
<divclass="sect3">
<h4id="_importing_into_eclipse_without_m2eclipse"><aclass="link"href="#_importing_into_eclipse_without_m2eclipse">Importing into eclipse without m2eclipse</a></h4>
<divclass="paragraph">
<p>If you prefer not to use m2eclipse you can generate eclipse project metadata using the
following command:</p>
</div>
<divclass="listingblock">
<divclass="content">
<pre>$ ./mvnw eclipse:eclipse</pre>
</div>
</div>
<divclass="paragraph">
<p>The generated eclipse projects can be imported by selecting <code>import existing projects</code>
<p>Spring Cloud is released under the non-restrictive Apache 2.0 license,
and follows a very standard Github development process, using Github
tracker for issues and merging pull requests into master. If you want
to contribute even something trivial please do not hesitate, but
follow the guidelines below.</p>
</div>
<divclass="sect2">
<h3id="_sign_the_contributor_license_agreement"><aclass="link"href="#_sign_the_contributor_license_agreement">Sign the Contributor License Agreement</a></h3>
<divclass="paragraph">
<p>Before we accept a non-trivial patch or pull request we will need you to sign the
Signing the contributor’s agreement does not grant anyone commit rights to the main
repository, but it does mean that we can accept your contributions, and you will get an
author credit if we do. Active contributors might be asked to join the core team, and
given the ability to merge pull requests.</p>
</div>
</div>
<divclass="sect2">
<h3id="_code_of_conduct"><aclass="link"href="#_code_of_conduct">Code of Conduct</a></h3>
<divclass="paragraph">
<p>This project adheres to the Contributor Covenant <ahref="https://github.com/spring-cloud/spring-cloud-build/blob/master/docs/src/main/asciidoc/code-of-conduct.adoc">code of
conduct</a>. By participating, you are expected to uphold this code. Please report
unacceptable behavior to <ahref="mailto:spring-code-of-conduct@pivotal.io">spring-code-of-conduct@pivotal.io</a>.</p>
</div>
</div>
<divclass="sect2">
<h3id="_code_conventions_and_housekeeping"><aclass="link"href="#_code_conventions_and_housekeeping">Code Conventions and Housekeeping</a></h3>
<divclass="paragraph">
<p>None of these is essential for a pull request, but they will all help. They can also be
added after the original pull request but before a merge.</p>
</div>
<divclass="ulist">
<ul>
<li>
<p>Use the Spring Framework code format conventions. If you use Eclipse
you can import formatter settings using the
<code>eclipse-code-formatter.xml</code> file from the
<p>Spring Cloud Build comes with a set of checkstyle rules. You can find them in the <code>spring-cloud-build-tools</code> module. The most notable files under the module are:</p>
<td>Add checkstyle plugin to your build and reporting phases</td>
</tr>
</table>
</div>
<divclass="paragraph">
<p>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 <code>${project.root}/src/checkstyle/checkstyle-suppressions.xml</code> with your suppressions. Example:</p>
<p>It’s advisable to copy the <code>${spring-cloud-build.rootFolder}/.editorconfig</code> and <code>${spring-cloud-build.rootFolder}/.springformat</code> to your project. That way, some default formatting rules will be applied. You can do so by running this script:</p>
<p>In order to setup Intellij you should import our coding conventions, inspection profiles and set up the checkstyle plugin.
The following files can be found in the <ahref="https://github.com/spring-cloud/spring-cloud-build/tree/master/spring-cloud-build-tools">Spring Cloud Build</a> project.</p>
<p>Go to <code>File</code>→<code>Settings</code>→<code>Editor</code>→<code>Code style</code>. There click on the icon next to the <code>Scheme</code> section. There, click on the <code>Import Scheme</code> value and pick the <code>Intellij IDEA code style XML</code> option. Import the <code>spring-cloud-build-tools/src/main/resources/intellij/Intellij_Spring_Boot_Java_Conventions.xml</code> file.</p>
<p>Go to <code>File</code>→<code>Settings</code>→<code>Editor</code>→<code>Inspections</code>. There click on the icon next to the <code>Profile</code> section. There, click on the <code>Import Profile</code> and import the <code>spring-cloud-build-tools/src/main/resources/intellij/Intellij_Project_Defaults.xml</code> file.</p>
</div>
<divclass="paragraph">
<divclass="title">Checkstyle</div>
<p>To have Intellij work with Checkstyle, you have to install the <code>Checkstyle</code> plugin. It’s advisable to also install the <code>Assertions2Assertj</code> to automatically convert the JUnit assertions</p>
<p>Go to <code>File</code>→<code>Settings</code>→<code>Other settings</code>→<code>Checkstyle</code>. There click on the <code>+</code> icon in the <code>Configuration file</code> 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 <code>checkstyle.xml</code> : <code><ahref="https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/main/resources/checkstyle.xml"class="bare">https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/main/resources/checkstyle.xml</a></code>). We need to provide the following variables:</p>
<p><code>checkstyle.header.file</code> - please point it to the Spring Cloud Build’s, <code>spring-cloud-build-tools/src/main/resources/checkstyle-header.txt</code> file either in your cloned repo or via the <code><ahref="https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/main/resources/checkstyle-header.txt"class="bare">https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/main/resources/checkstyle-header.txt</a></code> URL.</p>
<p><code>checkstyle.suppressions.file</code> - default suppressions. Please point it to the Spring Cloud Build’s, <code>spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml</code> file either in your cloned repo or via the <code><ahref="https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml"class="bare">https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml</a></code> URL.</p>
</li>
<li>
<p><code>checkstyle.additional.suppressions.file</code> - this variable corresponds to suppressions in your local project. E.g. you’re working on <code>spring-cloud-contract</code>. Then point to the <code>project-root/src/checkstyle/checkstyle-suppressions.xml</code> folder. Example for <code>spring-cloud-contract</code> would be: <code>/home/username/spring-cloud-contract/src/checkstyle/checkstyle-suppressions.xml</code>.</p>
</li>
</ul>
</div>
<divclass="admonitionblock important">
<table>
<tr>
<tdclass="icon">
<iclass="fa icon-important"title="Important"></i>
</td>
<tdclass="content">
Remember to set the <code>Scan Scope</code> to <code>All sources</code> since we apply checkstyle rules for production and test sources.