Pull requests are welcome! Any pull request should:
- Include at least one unit test to verify the change in behavior
- Include an end-to-end test in PlanetilerTests.java to verify any major new user-facing features work
- Format the change
./mvnw spotless:applyand test with./mvnw verifybefore pushing
To set up your local development environment:
- Fork the repo setup submodules
- Install Java 21 or later. You can download Java manually from Adoptium or
use:
- Windows installer
- macOS installer (or
brew install --cask temurin, orport install openjdk21-temurin) - Linux installer (or
apt-get install openjdk-21-jdk) - If you update from an older version of java on Ubuntu, run
sudo update-alternatives --config javaafter installing the new jdk.
- Build and run the tests (mvnw automatically downloads maven the first time
you run it):
-
on mac/linux:
./mvnw clean test -
on windows:
mvnw.cmd clean test -
or if you already have maven installed globally on your machine:
mvn clean test -
to run just one test e.g.
GeoUtilsTest:./mvnw -pl planetiler-core -Dtest=GeoUtilsTest test -
to run benchmarks e.g.
BenchmarkTileCoord:./scripts/build.sh java -cp planetiler-dist/target/planetiler-dist-*-with-deps.jar com.onthegomap.planetiler.benchmarks.BenchmarkTileCoord
-
GitHub Workflows will run regression tests on any pull request.
You can use any text editor as long as you format the code and test before pushing. A good IDE will make things a lot easier though.
- Install IntelliJ IDEA
- Install the Adapter for Eclipse Code Formatter plugin
- In IntelliJ, click
Open, navigate to the thepom.xmlfile in the local copy of this repo, andOpenthenOpen as Project- If IntelliJ asks (and you trust the code) then click
Trust Project
- If IntelliJ asks (and you trust the code) then click
- Under
Preferences -> Tools -> Actions on Save(orFile -> Settings -> Tools -> Actions on Saveon Linux) selectReformat codeandOptimize importsto automatically format code on save. - To verify everything works correctly, right click on
planetiler-core/src/test/javafolder and clickRun 'All Tests'
Troubleshooting:
- If any java source files show "Cannot resolve symbol..." errors for Planetiler classes, you might need to
select:
File -> Invalidate Caches... -> Just Restart. - If you see a "Project JDK is not defined" error, then choose
Setup SDKand point IntelliJ at the Java 21 or later installed on your system
- Install the Extension Pack for Java
- In VSCode, click
File -> Openand navigate to Planetiler directory- If VSCode asks (and you trust the code) then click
Yes I trust the authors
- If VSCode asks (and you trust the code) then click
- To verify everything works correctly, go to the
Testingtab and clickRun Tests
Learn more about using VSCode with Java here.
- In Eclipse for Java Developers, click
File -> Import ...thenMaven -> Existing Maven Projects, navigate to Planetiler directory, and clickFinish - Under
Eclipse -> Preferences...:- Under
Java -> Code Style -> Formatterand chooseImport...chooseeclipse-formatter.xmlfrom the root of this project. Then choosePlanetileras the Active profile. - Under
Java -> Editor -> Save ActionscheckPerform selected actions on save,Format source code,Format all linesandOrganize imports - Under
Java -> Code Style -> Organize Importschange thenumber of static imports needed for .*to 5, then remove the groups and add 2 new groups:New Static...and*New...and*
- Under
- To verify everything works correctly, right click on
planetiler-core/src/test/javafolder and clickRun As -> JUnit Test
Planetiler uses SonarCloud to statically analyze pull requests to catch common bugs and security vulnerabilities. To preview Sonar warnings in VS Code, IntelliJ, or Eclipse:
- Follow the directions on sonarlint.org to install the plugin for your IDE
- Then to synchronize your local configuration with the one used in SonarCloud,
enable connected mode for your IDE using "SonarCloud"
connection type and the shared read-only API token used in GitHub CI:
c2cfe8bd7368ced07e84a620b7c2487846e220eb
Generally it's fine to use AI tools to help create pull requests as long as you adhere to the following guidelines:
- State in your PR description what AI tool(s) you used to create the PR.
- Make sure a human has reviewed and fully understands all the code changes being submitted.
- Make sure the PR does not contain any unrelated changes.
- Make sure that the PR adheres to the project's coding standards and licensing guidelines.