style
esc
  • Loading…

Start hereJava Style Guide template

Conventions for writing, structuring, formatting and shipping modern Java 23 that compiles with zero warnings and no surprises.

Java 23google-java-formatMaven

A ready-to-build Maven multi-module repository on Java 23 with the guide's core, api and it modules, the appendix parent POM, jvm.config and .editorconfig, a billing feature with records and JSpecify null-marking, unit and integration tests, an HTTP API on the JDK's server, the Maven wrapper and CI.

  1. 1

    Download

    Pick a name and base package. Every package, module, Maven artifact and class name is renamed for you.

  2. 2

    Set up

    Install Temurin 23 (pinned in .sdkmanrc), then run ./mvnw spotless:apply once to re-sort imports for your package.

  3. 3

    Build

    ./mvnw verify checks formatting, compiles warning-free with Error Prone and NullAway, and runs unit and integration tests.

What you get

project/
├── .github/
│   ├── workflows/
│   │   └── ci.yml
│   └── dependabot.yml
├── .mvn/
│   ├── wrapper/
│   │   └── maven-wrapper.properties
│   └── jvm.config
├── docs/
│   └── adr/
│       └── 0001-project-scope.md
├── project-api/
│   ├── src/
│   │   ├── main/
│   │   │   └── java/
│   │   │       ├── com/
│   │   │       │   └── example/
│   │   │       │       └── project/
│   │   │       │           └── api/
│   │   │       │               ├── InvoiceHandler.java
│   │   │       │               ├── InvoiceJson.java
│   │   │       │               ├── package-info.java
│   │   │       │               └── ProjectApi.java
│   │   │       └── module-info.java
│   │   └── test/
│   │       └── java/
│   │           └── com/
│   │               └── example/
│   │                   └── project/
│   │                       └── api/
│   │                           └── InvoiceJsonTest.java
│   └── pom.xml
├── project-core/
│   ├── src/
│   │   ├── main/
│   │   │   ├── java/
│   │   │   │   ├── com/
│   │   │   │   │   └── example/
│   │   │   │   │       └── project/
│   │   │   │   │           └── billing/
│   │   │   │   │               ├── InMemoryInvoiceRepository.java
│   │   │   │   │               ├── Invoice.java
│   │   │   │   │               ├── InvoiceId.java
│   │   │   │   │               ├── InvoiceLine.java
│   │   │   │   │               ├── InvoiceRepository.java
│   │   │   │   │               ├── InvoiceRequest.java
│   │   │   │   │               ├── InvoiceService.java
│   │   │   │   │               ├── Money.java
│   │   │   │   │               └── package-info.java
│   │   │   │   └── module-info.java
│   │   │   └── resources/
│   │   └── test/
│   │       └── java/
│   │           └── com/
│   │               └── example/
│   │                   └── project/
│   │                       └── billing/
│   │                           ├── InvoiceServiceTest.java
│   │                           └── MoneyTest.java
│   └── pom.xml
├── project-it/
│   ├── src/
│   │   └── test/
│   │       └── java/
│   │           └── com/
│   │               └── example/
│   │                   └── project/
│   │                       └── it/
│   │                           ├── package-info.java
│   │                           └── ProjectApiIT.java
│   └── pom.xml
├── .editorconfig
├── .gitattributes
├── .gitignore
├── .java-version
├── .sdkmanrc
├── mvnw
├── mvnw.cmd
├── pom.xml
└── README.md