This file is written for agentic coding tools working in this repo. It captures the project's build/test/format commands and the house style that the CI and formatter expect.
- Tech: multi-module Maven (Java), source/target = 1.8 (see
pom.xml). - Modules:
core/(library),cli/(shaded CLI jar),maven/(Maven plugin),maven-example/(example usage; install/deploy skipped). - CI runs
./mvnw ... verifyon JDK 8/11/17/21 (see.github/workflows/*.yml). - Formatting:
com.coveo:fmt-maven-plugin(seepom.xml).
- Cursor rules: none found (no
.cursor/rules/and no.cursorrules). - Copilot rules: none found (no
.github/copilot-instructions.md).
Use the Maven wrapper (./mvnw) when possible to match CI.
# compile + run unit tests (all modules)
./mvnw test
# full CI-style verification (unit tests + packaging)
./mvnw verify
# clean build
./mvnw clean verify
# build just one module (and its deps)
./mvnw -pl core -am verify
./mvnw -pl cli -am package
# CI-style (adds some output + jacoco report)
./mvnw -V -B -ntp -ff verify jacoco:reportNotes:
- For faster local iteration, add
-DskipTests=truewhen appropriate.
# auto-format Java sources
./mvnw com.coveo:fmt-maven-plugin:format
# if the plugin supports it, fail if formatting differs (use in CI-like loops)
./mvnw com.coveo:fmt-maven-plugin:checkGit hook:
- A local pre-commit hook may run formatting (
.git/hooks/pre-commitruns./mvnw com.coveo:fmt-maven-plugin:format). Don't rely on it; run format explicitly when you change Java files.
# run all tests
./mvnw test
# run tests for a single module
./mvnw -pl core test
./mvnw -pl maven test
# run a single test class (Surefire)
./mvnw -pl core -Dtest=OpenApiDiffTest test
# run a single test method (JUnit 5 via Surefire)
./mvnw -pl core -Dtest=OpenApiDiffTest#testDiff testNotes:
- Test classes must match Surefire includes (convention here is
*Test.java). - If you only changed
cli/, tests likely live incore/; run./mvnw -pl core test.
The docker Maven profile disables tests/javadoc/sources and sets fmt.skip.
./mvnw -Pdocker package
docker build -t local-openapi-diff .# build shaded jar
./mvnw -pl cli -am package
# run (jar name includes version; use the *-all classifier)
java -jar cli/target/openapi-diff-cli-*-all.jar --help- Always run
./mvnw com.coveo:fmt-maven-plugin:formatafter editing Java. - Don't fight the formatter; structure code so it reads well after formatting.
- Keep lines/blocks simple; prefer extracting helper methods over deeply nested ternaries or chained calls.
- Let the formatter manage import ordering.
- Avoid wildcard imports.
- In tests, static imports are common and preferred for AssertJ:
import static org.assertj.core.api.Assertions.assertThat;
- Code must compile with Java 8 (no
var, records, text blocks, etc.). - Avoid APIs added after Java 8 even if they compile on newer JDKs.
- Packages stay under
org.openapitools.openapidiff. - Classes:
PascalCase; methods/fields:lowerCamelCase. - Constants:
UPPER_SNAKE_CASEandstatic final. - Prefer "Diff" suffix for comparison components (
*Diff,*DiffResult). - Tests:
*Testfor unit tests; use descriptive test method names.
- Be explicit about ownership/mutability. Prefer returning empty collections over
nullwhen you control the API. - When interacting with Swagger/OpenAPI models, expect nullable fields and guard accordingly.
- Prefer
finalfor local variables/fields when it improves readability.
- Library code: throw useful runtime exceptions for invalid input (see
OpenApiCompare.notNull(...)). - Avoid swallowing exceptions silently; log or rethrow.
- CLI / Maven plugin: prefer user-actionable messages; use SLF4J; use
MojoExecutionException/MojoFailureException.
- Frameworks: JUnit Jupiter (JUnit 5) + AssertJ.
- Keep tests deterministic; avoid depending on network.
- Put fixtures in
*/src/test/resources/and reference them in a way that works when Maven runs from the module directory. - When adding behavior, add a focused test in
core/unless the change is truly CLI-only or Maven-plugin-only.
- Line endings: contributors recommend
git config core.autocrlf input(seeCONTRIBUTING.md). - Prefer small, reviewable changes; add tests with fixes.
- Do not commit generated artifacts (
target/, shaded jars, etc.).