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.
- Host: GitHub
- URL: https://github.com/bcaillard/jspecify-packageinfo-generator
- Owner: bcaillard
- License: apache-2.0
- Created: 2025-07-12T09:07:07.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-11-23T14:24:41.000Z (about 2 months ago)
- Last Synced: 2025-11-23T16:16:01.567Z (about 2 months ago)
- Topics: generator, java, jspecify, maven-plugin, null-safety, package-info
- Language: Java
- Homepage:
- Size: 57.6 KB
- Stars: 1
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- fucking-awesome-java - JSpecify Package-Info Generator - Maven plugin that automatically generates package-info.java files with JSpecify annotations (@NullMarked and @NullUnmarked), helping you manage nullness boundaries in your Java projects without manual boilerplate. (Projects / Code Generators)
- awesome-java - JSpecify Package-Info Generator - Maven plugin that automatically generates package-info.java files with JSpecify annotations (@NullMarked and @NullUnmarked), helping you manage nullness boundaries in your Java projects without manual boilerplate. (Projects / Code Generators)
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.