These are the contribution guidelines for the commercetools-sync-java.
Thanks for taking the time to contribute 👍🎉 All contributions are welcome!
If you have push access to the repository you can fix them directly otherwise just make a pull request.
- Every PR should address an issue on the repository. If the issue doesn't exist, please create it first and link PR with the issue.
- After your PR is approved by all reviewers and the build is green:
- Use
Squash and mergeoption on a pull request on GitHub, with that the pull request's commits should be squashed into a single commit.Instead of seeing all of a contributor's individual commit messages, the commits should be combined into one commit message with a clear commit description.
- Delete the branch when the PR is closed.
- Close the issue only if the change was released.
- Use
./gradlew test./gradlew clean jar./gradlew clean check./gradlew clean build./gradlew clean install./gradlew clean javadoc gitPublishPush -Dbuild.version={version}./gradlew clean -Dbuild.version={version} publishToSonatype closeAndReleaseSonatypeStagingRepositoryFor more detailed information on the build and the release process, see Build and Release documentation.
-
The integration tests of the library require to have two CTP projects (a source project and a target project) where the data will be tested to be synced from the source to the target project.
-
Running the tests does the following:
- Clean all the data on both projects.
- Create test data in either/both projects depending on the test.
- Execute the tests.
- Clean all the data in both projects, leaving them empty.
To run the integration tests, CTP credentials are required. The credential can be obtained once you create a CTP project. For details, please refer to the following link: https://docs.commercetools.com/merchant-center/projects.html#creating-a-project
- Use credentials Java properties file
/src/integration-test/resources/it.properties:
source.projectKey=aaaaa
source.clientId=bbbbbbb
source.clientSecret=ccc
target.projectKey=ddddd
target.clientId=eeeeeee
target.clientSecret=fffUse it.properties.skeleton
as a template to setup the credentials.
Note: the it.properties file must be ignored by VCS.
- Set the following environment variables:
export SOURCE_PROJECT_KEY = xxxxxxxxxxxxx
export SOURCE_CLIENT_ID = xxxxxxxxxxxxxxx
export SOURCE_CLIENT_SECRET = xxxxxxxxxxx
export TARGET_PROJECT_KEY = xxxxxxxxxxxxx
export TARGET_CLIENT_ID = xxxxxxxxxxxxxxx
export TARGET_CLIENT_SECRET = xxxxxxxxxxxNote: it.properties file has precedence over environment variables. If the file exists -
the environment variables are ignored. If the existing it.properties file is empty or one of the properties
is missing - exception will be thrown on the execution of the tests
If one of the two options above is set - run the integration tests:
./gradlew integrationTestWe are using google-java-format to format Java source code to comply with Google Java Style.
A google-java-format IntelliJ plugin is available from the plugin repository. To install it, go to your IDE's settings and select the Plugins category. Click the Marketplace tab, search for the google-java-format plugin, and click the Install button.
The plugin will be disabled by default. To enable it in the current project, go to File→Settings...→google-java-format Settings (or IntelliJIDEA→Preferences...→Other Settings→google-java-format Settings on macOS) and check the Enable google-java-format checkbox. (A notification will be presented when you first open a project offering to do this for you.)
To enable it by default in new projects, use File→Other Settings→Default Settings....
When enabled, it will replace the normal Reformat Code action, which can be triggered by the Code menu or with the Ctrl-Alt (by default) keyboard shortcut.
google-java-format Eclipse plugin can be downloaded from the releases page. Drop it into the Eclipsedrop-ins folderto activate the plugin.
The plugin adds a google-java-format formatter implementation that can be configured in Window > Preferences > Java > Code Style > Formatter > Formatter Implementation.
./gradlew spotlessCheck./gradlew spotlessApplyTo exclude the formatting commits git blame supports writing the commit hashes into a file and then referencing the file with --ignore-revs-file.
To be able to archive that git blame ./file.java --ignore-revs-file .git-blame-ignore-revs command to ignore this revision to find a better git history.
Also git config blame.ignoreRevsFile .git-blame-ignore-revs could be configured to ignore this revision always.
We create
.git-blame-ignore-revsthat could be found in the repository.