Skip to content

Working with the Code

Chris Bono edited this page Jan 15, 2023 · 1 revision

See the CONTRIBUTING file in the repository for information on how to contribute issues and code changes to the project.

Building from Source

Spring Cloud Dataflow source can be built from the command line using Maven. We include Maven’s wrapper scripts (./mvnw or mvnw.cmd) that you can run rather than needing to install Maven locally.

The source on the main branch should be built with JDK 8.

The project can be built from the root directory using the standard Maven command:

$ ./mvnw build

Development Strategy

We use the "Fork and Branch" Git workflow. In a nutshell, the process is this:

Fork a GitHub repository

  • Owner: - <YOUR_GITHUB_USERNAME>

  • Repository name: spring-cloud-dataflow

Clone the forked repository to your local system

Clone your fork by executing the following command in the desired dev directory:

git clone https://github.com/<YOUR_GITHUB_USERNAME>/spring-cloud-dataflow.git

Add a Git remote for the original repository

Create a "remote" to allow you to push changes back up to the forked repository by executing the following command in the repo directory:

git remote add upstream https://github.com/spring-cloud/spring-cloud-dataflow.git

Create a feature branch in which to place your changes

Create a branch to work in w/ the following command:

git checkout -b <some-decent-description-of-branch>

Make your changes to the new branch

Code up the changes, add the tests, etc.. by following the code-conventions-and-housekeeping from the CONTRIBUTING guide.

Commit the changes to the branch

Commit the changes to the branch (again referring to the code-conventions-and-housekeeping from the CONTRIBUTING guide.

Push the branch to GitHub

Push the changes to Github w/ git push origin <BRANCH_NAME>.

Open a pull request from the new branch to the original repo

Navigate to your Fork repo in Github and create a PR by following this link:

https://github.com/spring-cloud/spring-cloud-dataflow/compare/main...<YOUR_GITHUB_USERNAME>:spring-cloud-dataflow:<BRANCH_NAME>

and clicking "Create pull request" button.

Using an IDE

Importing into IntelliJ IDEA

If you have performed a checkout of this repository already, use “File” → “Open” and then select the root pom.xml file to import the code.

Alternatively, you can let IntelliJ IDEA checkout the code for you. Use “File” → “New” → “Project from Version Control” and https://github.com/spring-cloud/spring-cloud-dataflow for the URL. Once the checkout has completed, a pop-up will suggest to open the project.

Importing into Other IDEs

Maven is supported by most Java IDEs. Refer to your vendor documentation.

Code Formatting

The directory src/eclipse has two files for use with code formatting, eclipse-code-formatter.xml for the majority of the code formatting rules and eclipse.importorder to order the import statements.

Eclipse

In Eclipse you import these files by navigating Windows → Preferences and then the menu items Preferences > Java > Code Style > Formatter and Preferences > Java > Code Style > Organize Imports respectfully.

IntelliJ

  • Install the plugin Eclipse Code Formatter.

    • You can find it by searching the "Browse Repositories" under the plugin option within IntelliJ (Once installed you will need to reboot Intellij for it to take effect).

  • Navigate to Intellij IDEA > Preferences and select the Eclipse Code Formatter.

    • Select the eclipse-code-formatter.xml file for the field Eclipse Java Formatter config file

    • Select the eclipse.importorder file for the field Import order.

  • Enable the Eclipse code formatter by clicking Use the Eclipse code formatter then click the OK button.

Note
If you configure the Eclipse Code Formatter from File > Other Settings > Default Settings it will set this policy across all of your Intellij projects.

Cloning the git repository on Windows

Some files in the git repository may exceed the Windows maximum file path (260 characters), depending on where you clone the repository. If you get Filename too long errors, set the core.longPaths=true git option:

git clone -c core.longPaths=true https://github.com/spring-cloud/spring-cloud-dataflow