Skip to content

Commit fb390b3

Browse files
authored
Merge pull request #906 from drewmullen/main
Doc: Fix contributing and build links
2 parents 88424a8 + 477856a commit fb390b3

3 files changed

Lines changed: 329 additions & 10 deletions

File tree

README.adoc

Lines changed: 324 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -313,21 +313,339 @@ They will also create a root token `00000000-0000-0000-0000-000000000000`.
313313

314314
Changes to the documentation should be made to the adocs found under `docs/src/main/asciidoc/`
315315

316-
`README.adoc` can be re-generated via the following
316+
`README.adoc` can be re-generated from the `docs/` directory via the following
317317

318318
[source,bash]
319319
----
320-
$ ./docs/src/main/ruby/generate_readme.sh > README.adoc
320+
$ ../mvnw clean install -Pdocs
321321
----
322322

323323
This script requires ruby and the asciidoctor gem installed (`gem install asciidoctor`)
324324

325-
[[building]]
326-
= Building
325+
:jdkversion: 17
326+
327+
[[basic-compile-and-test]]
328+
== Basic Compile and Test
329+
330+
To build the source you will need to install JDK {jdkversion}.
331+
332+
Spring Cloud uses Maven for most build-related activities, and you
333+
should be able to get off the ground quite quickly by cloning the
334+
project you are interested in and typing
335+
336+
----
337+
$ ./mvnw install
338+
----
339+
340+
NOTE: You can also install Maven (>=3.3.3) yourself and run the `mvn` command
341+
in place of `./mvnw` in the examples below. If you do that you also
342+
might need to add `-P spring` if your local Maven settings do not
343+
contain repository declarations for spring pre-release artifacts.
344+
345+
NOTE: Be aware that you might need to increase the amount of memory
346+
available to Maven by setting a `MAVEN_OPTS` environment variable with
347+
a value like `-Xmx512m -XX:MaxPermSize=128m`. We try to cover this in
348+
the `.mvn` configuration, so if you find you have to do it to make a
349+
build succeed, please raise a ticket to get the settings added to
350+
source control.
351+
352+
The projects that require middleware (i.e. Redis) for testing generally
353+
require that a local instance of https://www.docker.com/get-started[Docker] is installed and running.
354+
355+
[[documentation]]
356+
== Documentation
357+
358+
The spring-cloud-build module has a "docs" profile, and if you switch
359+
that on it will try to build asciidoc sources using https://docs.antora.org/antora/latest/[Antora] from
360+
`modules/ROOT/`.
361+
362+
As part of that process it will look for a
363+
`docs/src/main/asciidoc/README.adoc` and process it by loading all the includes, but not
364+
parsing or rendering it, just copying it to `${main.basedir}`
365+
(defaults to `$\{basedir}`, i.e. the root of the project). If there are
366+
any changes in the README it will then show up after a Maven build as
367+
a modified file in the correct place. Just commit it and push the change.
368+
369+
[[working-with-the-code]]
370+
== Working with the code
371+
If you don't have an IDE preference we would recommend that you use
372+
https://spring.io/tools[Spring Tools Suite] or
373+
https://eclipse.org[Eclipse] when working with the code. We use the
374+
https://eclipse.org/m2e/[m2eclipse] eclipse plugin for maven support. Other IDEs and tools
375+
should also work without issue as long as they use Maven 3.3.3 or better.
376+
377+
[[activate-the-spring-maven-profile]]
378+
=== Activate the Spring Maven profile
379+
Spring Cloud projects require the 'spring' Maven profile to be activated to resolve
380+
the spring milestone and snapshot repositories. Use your preferred IDE to set this
381+
profile to be active, or you may experience build errors.
382+
383+
[[importing-into-eclipse-with-m2eclipse]]
384+
=== Importing into eclipse with m2eclipse
385+
We recommend the https://eclipse.org/m2e/[m2eclipse] eclipse plugin when working with
386+
eclipse. If you don't already have m2eclipse installed it is available from the "eclipse
387+
marketplace".
388+
389+
NOTE: Older versions of m2e do not support Maven 3.3, so once the
390+
projects are imported into Eclipse you will also need to tell
391+
m2eclipse to use the right profile for the projects. If you
392+
see many different errors related to the POMs in the projects, check
393+
that you have an up to date installation. If you can't upgrade m2e,
394+
add the "spring" profile to your `settings.xml`. Alternatively you can
395+
copy the repository settings from the "spring" profile of the parent
396+
pom into your `settings.xml`.
397+
398+
[[importing-into-eclipse-without-m2eclipse]]
399+
=== Importing into eclipse without m2eclipse
400+
If you prefer not to use m2eclipse you can generate eclipse project metadata using the
401+
following command:
402+
403+
[indent=0]
404+
----
405+
$ ./mvnw eclipse:eclipse
406+
----
407+
408+
The generated eclipse projects can be imported by selecting `import existing projects`
409+
from the `file` menu.
327410

328-
Unresolved directive in https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/modules/ROOT/pages/building.adoc - include::partial$building.adoc[]
329411

330412
[[contributing]]
331413
= Contributing
332414

333-
Unresolved directive in <stdin> - include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/contributing.adoc[]
415+
:spring-cloud-build-branch: main
416+
417+
Spring Cloud is released under the non-restrictive Apache 2.0 license,
418+
and follows a very standard Github development process, using Github
419+
tracker for issues and merging pull requests into main. If you want
420+
to contribute even something trivial please do not hesitate, but
421+
follow the guidelines below.
422+
423+
[[developer-certificate-of-origin]]
424+
== Developer Certificate of Origin (DCO)
425+
426+
All commits must include a __Signed-off-by__ trailer at the end of each commit message to indicate that the contributor agrees to the Developer Certificate of Origin.
427+
For additional details, please refer to the blog post https://spring.io/blog/2025/01/06/hello-dco-goodbye-cla-simplifying-contributions-to-spring[Hello DCO, Goodbye CLA: Simplifying Contributions to Spring].
428+
429+
[[code-of-conduct]]
430+
== Code of Conduct
431+
This project adheres to the Contributor Covenant https://github.com/spring-cloud/spring-cloud-build/blob/main/docs/modules/ROOT/partials/code-of-conduct.adoc[code of
432+
conduct]. By participating, you are expected to uphold this code. Please report
433+
unacceptable behavior to code-of-conduct@spring.io.
434+
435+
[[code-conventions-and-housekeeping]]
436+
== Code Conventions and Housekeeping
437+
None of these is essential for a pull request, but they will all help. They can also be
438+
added after the original pull request but before a merge.
439+
440+
* Use the Spring Framework code format conventions. If you use Eclipse
441+
you can import formatter settings using the
442+
`eclipse-code-formatter.xml` file from the
443+
https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/spring-cloud-dependencies-parent/eclipse-code-formatter.xml[Spring
444+
Cloud Build] project. If using IntelliJ, you can use the
445+
https://plugins.jetbrains.com/plugin/6546[Eclipse Code Formatter
446+
Plugin] to import the same file.
447+
* Make sure all new `.java` files to have a simple Javadoc class comment with at least an
448+
`@author` tag identifying you, and preferably at least a paragraph on what the class is
449+
for.
450+
* Add the ASF license header comment to all new `.java` files (copy from existing files
451+
in the project)
452+
* Add yourself as an `@author` to the .java files that you modify substantially (more
453+
than cosmetic changes).
454+
* Add some Javadocs and, if you change the namespace, some XSD doc elements.
455+
* A few unit tests would help a lot as well -- someone has to do it.
456+
* If no-one else is using your branch, please rebase it against the current main (or
457+
other target branch in the main project).
458+
* When writing a commit message please follow https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html[these conventions],
459+
if you are fixing an existing issue please add `Fixes gh-XXXX` at the end of the commit
460+
message (where XXXX is the issue number).
461+
462+
[[checkstyle]]
463+
== Checkstyle
464+
465+
Spring Cloud Build comes with a set of checkstyle rules. You can find them in the `spring-cloud-build-tools` module. The most notable files under the module are:
466+
467+
.spring-cloud-build-tools/
468+
----
469+
└── src
470+
   ├── checkstyle
471+
   │   └── checkstyle-suppressions.xml <3>
472+
   └── main
473+
   └── resources
474+
   ├── checkstyle-header.txt <2>
475+
   └── checkstyle.xml <1>
476+
----
477+
<1> Default Checkstyle rules
478+
<2> File header setup
479+
<3> Default suppression rules
480+
481+
[[checkstyle-configuration]]
482+
=== Checkstyle configuration
483+
484+
Checkstyle rules are *disabled by default*. To add checkstyle to your project just define the following properties and plugins.
485+
486+
.pom.xml
487+
----
488+
<properties>
489+
<maven-checkstyle-plugin.failsOnError>true</maven-checkstyle-plugin.failsOnError> <1>
490+
<maven-checkstyle-plugin.failsOnViolation>true
491+
</maven-checkstyle-plugin.failsOnViolation> <2>
492+
<maven-checkstyle-plugin.includeTestSourceDirectory>true
493+
</maven-checkstyle-plugin.includeTestSourceDirectory> <3>
494+
</properties>
495+
496+
<build>
497+
<plugins>
498+
<plugin> <4>
499+
<groupId>io.spring.javaformat</groupId>
500+
<artifactId>spring-javaformat-maven-plugin</artifactId>
501+
</plugin>
502+
<plugin> <5>
503+
<groupId>org.apache.maven.plugins</groupId>
504+
<artifactId>maven-checkstyle-plugin</artifactId>
505+
</plugin>
506+
</plugins>
507+
508+
<reporting>
509+
<plugins>
510+
<plugin> <5>
511+
<groupId>org.apache.maven.plugins</groupId>
512+
<artifactId>maven-checkstyle-plugin</artifactId>
513+
</plugin>
514+
</plugins>
515+
</reporting>
516+
</build>
517+
----
518+
<1> Fails the build upon Checkstyle errors
519+
<2> Fails the build upon Checkstyle violations
520+
<3> Checkstyle analyzes also the test sources
521+
<4> Add the Spring Java Format plugin that will reformat your code to pass most of the Checkstyle formatting rules
522+
<5> Add checkstyle plugin to your build and reporting phases
523+
524+
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 `${project.root}/src/checkstyle/checkstyle-suppressions.xml` with your suppressions. Example:
525+
526+
.projectRoot/src/checkstyle/checkstyle-suppressions.xml
527+
----
528+
<?xml version="1.0"?>
529+
<!DOCTYPE suppressions PUBLIC
530+
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
531+
"https://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
532+
<suppressions>
533+
<suppress files=".*ConfigServerApplication\.java" checks="HideUtilityClassConstructor"/>
534+
<suppress files=".*ConfigClientWatch\.java" checks="LineLengthCheck"/>
535+
</suppressions>
536+
----
537+
538+
It's advisable to copy the `${spring-cloud-build.rootFolder}/.editorconfig` and `${spring-cloud-build.rootFolder}/.springformat` to your project. That way, some default formatting rules will be applied. You can do so by running this script:
539+
540+
[source,bash]
541+
----
542+
$ curl https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/.editorconfig -o .editorconfig
543+
$ touch .springformat
544+
----
545+
546+
[[ide-setup]]
547+
== IDE setup
548+
549+
[[intellij-idea]]
550+
=== Intellij IDEA
551+
552+
In order to setup Intellij you should import our coding conventions, inspection profiles and set up the checkstyle plugin.
553+
The following files can be found in the https://github.com/spring-cloud/spring-cloud-build/tree/main/spring-cloud-build-tools[Spring Cloud Build] project.
554+
555+
.spring-cloud-build-tools/
556+
----
557+
└── src
558+
   ├── checkstyle
559+
   │   └── checkstyle-suppressions.xml <3>
560+
   └── main
561+
   └── resources
562+
   ├── checkstyle-header.txt <2>
563+
   ├── checkstyle.xml <1>
564+
   └── intellij
565+
      ├── Intellij_Project_Defaults.xml <4>
566+
      └── Intellij_Spring_Boot_Java_Conventions.xml <5>
567+
----
568+
<1> Default Checkstyle rules
569+
<2> File header setup
570+
<3> Default suppression rules
571+
<4> Project defaults for Intellij that apply most of Checkstyle rules
572+
<5> Project style conventions for Intellij that apply most of Checkstyle rules
573+
574+
.Code style
575+
576+
image::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/modules/ROOT/assets/images/intellij-code-style.png[Code style]
577+
578+
Go to `File` -> `Settings` -> `Editor` -> `Code style`. There click on the icon next to the `Scheme` section. There, click on the `Import Scheme` value and pick the `Intellij IDEA code style XML` option. Import the `spring-cloud-build-tools/src/main/resources/intellij/Intellij_Spring_Boot_Java_Conventions.xml` file.
579+
580+
.Inspection profiles
581+
582+
image::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/modules/ROOT/assets/images/intellij-inspections.png[Code style]
583+
584+
Go to `File` -> `Settings` -> `Editor` -> `Inspections`. There click on the icon next to the `Profile` section. There, click on the `Import Profile` and import the `spring-cloud-build-tools/src/main/resources/intellij/Intellij_Project_Defaults.xml` file.
585+
586+
.Checkstyle
587+
588+
To have Intellij work with Checkstyle, you have to install the `Checkstyle` plugin. It's advisable to also install the `Assertions2Assertj` to automatically convert the JUnit assertions
589+
590+
image::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/modules/ROOT/assets/images/intellij-checkstyle.png[Checkstyle]
591+
592+
Go to `File` -> `Settings` -> `Other settings` -> `Checkstyle`. There click on the `+` icon in the `Configuration file` 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 `checkstyle.xml` : `https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/spring-cloud-build-tools/src/main/resources/checkstyle.xml`). We need to provide the following variables:
593+
594+
- `checkstyle.header.file` - please point it to the Spring Cloud Build's, `spring-cloud-build-tools/src/main/resources/checkstyle-header.txt` file either in your cloned repo or via the `https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/spring-cloud-build-tools/src/main/resources/checkstyle-header.txt` URL.
595+
- `checkstyle.suppressions.file` - default suppressions. Please point it to the Spring Cloud Build's, `spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml` file either in your cloned repo or via the `https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/spring-cloud-build-tools/src/checkstyle/checkstyle-suppressions.xml` URL.
596+
- `checkstyle.additional.suppressions.file` - this variable corresponds to suppressions in your local project. E.g. you're working on `spring-cloud-contract`. Then point to the `project-root/src/checkstyle/checkstyle-suppressions.xml` folder. Example for `spring-cloud-contract` would be: `/home/username/spring-cloud-contract/src/checkstyle/checkstyle-suppressions.xml`.
597+
598+
IMPORTANT: Remember to set the `Scan Scope` to `All sources` since we apply checkstyle rules for production and test sources.
599+
600+
[[duplicate-finder]]
601+
== Duplicate Finder
602+
603+
Spring Cloud Build brings along the `basepom:duplicate-finder-maven-plugin`, that enables flagging duplicate and conflicting classes and resources on the java classpath.
604+
605+
[[duplicate-finder-configuration]]
606+
=== Duplicate Finder configuration
607+
608+
Duplicate finder is *enabled by default* and will run in the `verify` phase of your Maven build, but it will only take effect in your project if you add the `duplicate-finder-maven-plugin` to the `build` section of the project's `pom.xml`.
609+
610+
.pom.xml
611+
[source,xml]
612+
----
613+
<build>
614+
<plugins>
615+
<plugin>
616+
<groupId>org.basepom.maven</groupId>
617+
<artifactId>duplicate-finder-maven-plugin</artifactId>
618+
</plugin>
619+
</plugins>
620+
</build>
621+
----
622+
623+
For other properties, we have set defaults as listed in the https://github.com/basepom/duplicate-finder-maven-plugin/wiki[plugin documentation].
624+
625+
You can easily override them but setting the value of the selected property prefixed with `duplicate-finder-maven-plugin`. For example, set `duplicate-finder-maven-plugin.skip` to `true` in order to skip duplicates check in your build.
626+
627+
If you need to add `ignoredClassPatterns` or `ignoredResourcePatterns` to your setup, make sure to add them in the plugin configuration section of your project:
628+
629+
[source,xml]
630+
----
631+
<build>
632+
<plugins>
633+
<plugin>
634+
<groupId>org.basepom.maven</groupId>
635+
<artifactId>duplicate-finder-maven-plugin</artifactId>
636+
<configuration>
637+
<ignoredClassPatterns>
638+
<ignoredClassPattern>org.joda.time.base.BaseDateTime</ignoredClassPattern>
639+
<ignoredClassPattern>.*module-info</ignoredClassPattern>
640+
</ignoredClassPatterns>
641+
<ignoredResourcePatterns>
642+
<ignoredResourcePattern>changelog.txt</ignoredResourcePattern>
643+
</ignoredResourcePatterns>
644+
</configuration>
645+
</plugin>
646+
</plugins>
647+
</build>
648+
649+
650+
----
651+

docs/modules/ROOT/partials/_configprops.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@
134134
|spring.cloud.vault.ssl.key-store | | Trust store that holds certificates and private keys.
135135
|spring.cloud.vault.ssl.key-store-password | | Password used to access the key store.
136136
|spring.cloud.vault.ssl.key-store-type | | Type of the key store. @since 3.0
137+
|spring.cloud.vault.ssl.role | | Name of the role against which the login is being attempted. @since 5.0
137138
|spring.cloud.vault.ssl.trust-store | | Trust store that holds SSL certificates.
138139
|spring.cloud.vault.ssl.trust-store-password | | Password used to access the trust store.
139140
|spring.cloud.vault.ssl.trust-store-type | | Type of the trust store. @since 3.0

docs/src/main/asciidoc/README.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,18 @@ They will also create a root token `00000000-0000-0000-0000-000000000000`.
5454

5555
Changes to the documentation should be made to the adocs found under `docs/src/main/asciidoc/`
5656

57-
`README.adoc` can be re-generated via the following
57+
`README.adoc` can be re-generated from the `docs/` directory via the following
5858

5959
[source,bash]
6060
----
61-
$ ./docs/src/main/ruby/generate_readme.sh > README.adoc
61+
$ ../mvnw clean install -Pdocs
6262
----
6363

6464
This script requires ruby and the asciidoctor gem installed (`gem install asciidoctor`)
6565

66-
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/modules/ROOT/pages/building.adoc[]
66+
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/modules/ROOT/partials/building.adoc[]
6767

6868
[[contributing]]
6969
= Contributing
7070

71-
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/contributing.adoc[]
71+
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/modules/ROOT/partials/contributing.adoc[]

0 commit comments

Comments
 (0)