https://github.com/l3r8yj/prefixed-maven-plugin
A Maven plugin that enforces naming conventions for classes implementing interfaces annotated with `@RequirePrefix`
https://github.com/l3r8yj/prefixed-maven-plugin
Last synced: 6 months ago
JSON representation
A Maven plugin that enforces naming conventions for classes implementing interfaces annotated with `@RequirePrefix`
- Host: GitHub
- URL: https://github.com/l3r8yj/prefixed-maven-plugin
- Owner: l3r8yJ
- License: mit
- Created: 2025-02-12T12:34:59.000Z (8 months ago)
- Default Branch: master
- Last Pushed: 2025-04-07T17:01:38.000Z (6 months ago)
- Last Synced: 2025-04-12T23:55:37.268Z (6 months ago)
- Language: Java
- Homepage:
- Size: 85.9 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# prefixed-maven-plugin
[](https://central.sonatype.com/artifact/ru.l3r8y/prefixed-maven-plugin)
[](https://opensource.org/license/mit)A Maven plugin to enforce prefix-based naming conventions for classes
implementing annotated interfaces.## Overview
This plugin scans classes implementing interfaces annotated with
`@RequirePrefix(prefix = "YourPrefix")` and ensures that their names start with the
specified prefix. If a violation is detected, the build fails, promoting
consistent code style and adherence to naming contracts.## Features
* **Annotation-driven validation**: Uses `@RequirePrefix` to define required
prefixes for interface implementations.
* **Build enforcement**: Fails the build if classes violate the prefix rule.
* **Customizable checks**: Configure scanning phases and excluded packages.## Installation
Add the plugin to your `pom.xml`:
```xml
ru.l3r8y
prefixed-maven-plugin
${latest}
enforce
```
## Usage
Annotate your interface with `@RequirePrefix`:
```java
import ru.l3r8y.prefixed.annotation.RequirePrefix;@RequirePrefix(prefix = "Logger")
public interface Logger { ...
}
```Implement the interface with a correctly prefixed class:
```java
public class LoggerFile implements Logger { ...
} // ✅ Validpublic class FileLogger implements Logger { ...
} // ❌Fails build
```Run the plugin:
```bash
mvn clean verify
```## Configuration
Configure the plugin in your `pom.xml`:
```xml
true
{groupId}```
## Contributing
Pull requests are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
## License
MIT © [Ivan Ivanchuk]