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

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`

Awesome Lists containing this project

README

          

# prefixed-maven-plugin

[![Maven Central](https://img.shields.io/maven-central/v/ru.l3r8y/prefixed-maven-plugin)](https://central.sonatype.com/artifact/ru.l3r8y/prefixed-maven-plugin)
[![License](https://img.shields.io/badge/license-MIT-blue)](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 { ...
} // ✅ Valid

public 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]