# prettier-plugin-java

> Prettier Java Plugin

Latest version **2.10.3** (published 2026-07-19) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install prettier-plugin-java
pnpm add prettier-plugin-java
yarn add prettier-plugin-java
bun add prettier-plugin-java
```

## Health

**Score 60/100 (C)** — status: active.

Positive: esm support; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 2.10.3 |
| Published | 2026-07-19 |
| First published | 2018-01-15 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 789.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1213 |
| Maintainers | jdubois, deepu105, cdessoude, jtkiesel, thorbenvh8 |

## Links

- npm: https://www.npmjs.com/package/prettier-plugin-java
- Repository: https://github.com/jhipster/prettier-java
- Homepage: https://jhipster.github.io/prettier-java/
- Issues: https://github.com/jhipster/prettier-java/issues
- npm.io page: https://npm.io/package/prettier-plugin-java

## Dependencies (1)

- [web-tree-sitter](https://npm.io/package/web-tree-sitter.md) 0.26.11

## Recent versions

- 2.10.3 (latest) — 2026-07-19
- 2.10.2 — 2026-06-30
- 2.10.1 — 2026-06-25
- 2.10.0 — 2026-06-22
- 2.9.7 — 2026-05-28
- 2.9.6 — 2026-05-26
- 2.9.5 — 2026-05-25
- 2.9.4 — 2026-05-21
- 2.9.3 — 2026-05-21
- 2.9.2 — 2026-05-17
- 2.9.1 — 2026-05-16
- 2.9.0 — 2026-05-16
- 2.8.1 — 2026-01-08
- 2.8.0 — 2026-01-06
- 2.7.7 — 2025-10-20
- … 58 more at https://npm.io/package/prettier-plugin-java/versions

## README

[![Prettier Java Banner](https://raw.githubusercontent.com/jhipster/prettier-java/main/logo/prettier-java-banner-light.svg)](https://www.jhipster.tech/prettier-java/)

# Prettier Java Plugin

[![CI Status](https://img.shields.io/github/actions/workflow/status/jhipster/prettier-java/github-ci.yml?branch=main&style=flat-square&label=CI)](https://github.com/jhipster/prettier-java/actions/workflows/github-ci.yml?query=branch%3Amain) [![npm version](https://img.shields.io/npm/v/prettier-plugin-java.svg?style=flat-square)](https://www.npmjs.com/package/prettier-plugin-java) [![weekly downloads from npm](https://img.shields.io/npm/dw/prettier-plugin-java.svg?style=flat-square)](https://www.npmjs.com/package/prettier-plugin-java) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier#badge)

## Intro

Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary.

This plugin adds support for the Java language to Prettier.

### Input

<!-- prettier-ignore -->
```java
public class HelloWorld {
public static void main(String[] args) {System.out.println("Hello World!");;;;;}

@Override
public String toString() {
  return "Hello World";
}
  public int sum(int argument1,int argument2,int argument3,int argument4,int argument5
  ) {
    return argument1+argument2+ argument3 +argument4  + argument5;
  }
}
```

### Output

```java
public class HelloWorld {

  public static void main(String[] args) {
    System.out.println("Hello World!");
  }

  @Override
  public String toString() {
    return "Hello World";
  }

  public int sum(
    int argument1,
    int argument2,
    int argument3,
    int argument4,
    int argument5
  ) {
    return argument1 + argument2 + argument3 + argument4 + argument5;
  }
}
```

### Playground

You can give the plugin a try in our [playground](https://www.jhipster.tech/prettier-java/playground)!

## Getting Started

### Installation

npm:

```shell
npm install --save-dev --save-exact prettier prettier-plugin-java
```

Yarn:

```shell
yarn add --dev --exact prettier prettier-plugin-java
```

### Usage

npm:

```shell
npx prettier --plugin=prettier-plugin-java --write "**/*.java"
```

Yarn:

```shell
yarn exec prettier --plugin=prettier-plugin-java --write "**/*.java"
```

### Integration

- [Editors](docs/advanced_usage.md#ide-integrations)
- [Spotless](https://github.com/diffplug/spotless) lets you run Prettier from [Gradle](https://github.com/diffplug/spotless/tree/main/plugin-gradle#prettier) or [Maven](https://github.com/diffplug/spotless/tree/main/plugin-maven#prettier)

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md).

---
_Source: https://npm.io/package/prettier-plugin-java · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
