An open API service indexing awesome lists of open source software.

https://github.com/bcaillard/jspecify-packageinfo-generator

This Maven plugin automatically generates package-info.java files with JSpecify annotations (@NullMarked or @NullUnmarked), helping you manage nullness boundaries in your Java projects without manual boilerplate.
https://github.com/bcaillard/jspecify-packageinfo-generator

generator java jspecify maven-plugin null-safety package-info

Last synced: 1 day ago
JSON representation

This Maven plugin automatically generates package-info.java files with JSpecify annotations (@NullMarked or @NullUnmarked), helping you manage nullness boundaries in your Java projects without manual boilerplate.

Awesome Lists containing this project

README

          

# JSpecify Package Info Generator Maven Plugin

This Maven plugin automatically generates `package-info.java` files with [JSpecify](https://jspecify.dev) annotations (`@NullMarked` and `@NullUnmarked`), helping you manage
nullness boundaries in your Java projects without manual boilerplate.

It scans your source directories, creates missing `package-info.java` files where needed, and adds either `@NullMarked` or `@NullUnmarked` based on your configuration. This allows
you to systematically adopt JSpecify nullness tracking across your codebase while maintaining a clean structure.

If you discover JSpecify, remember to take a look at [NullAway](https://github.com/uber/NullAway) to eliminate NullPointerException in your Java projects.

## Goals

- Automatically creates `package-info.java` files in packages that are missing them
- Adds `@NullMarked` or `@NullUnmarked` from JSpecify to support null-safety adoption
- Reduces repetitive manual work when migrating to JSpecify
- Automatically adds generated directories to Maven source roots so they are compiled (thanks to [@jjlharrison](https://github.com/jjlharrison))

## Requirements

- **Java 11 or higher**
- **Maven 3+**

## Usage

Add the plugin to your `pom.xml`:

```xml



io.github.bcaillard.jspecify-utilities
jspecify-packageinfo-generator-maven-plugin
(pick version)




generate-package-info

generate-package-info-test





false

NULL_UNMARKED

RUN

false


```

## Be careful with Maven Compiler Plugin

Since version `3.12.0`, there's a regression that makes it impossible to use generated-sources.
See [MCOMPILER-538](https://github.com/apache/maven-compiler-plugin/pull/191).

## License

This project is licensed under the Apache License 2.0. See the [LICENSE](LICENSE) file for details.