apache / apache/maven

[MNG-7154] "Inline" build helper classes, "build AOP"

Open
#7,961 0 comments 0 reactions 0 assignees View on GitHub
priority:minor
Dominant language
Java
Stars
5.3k
Forks
3.1k
Avg merge
20h 42m
Merged PRs (30d)
297

Description

**[Gruust](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=gruust)** opened **[MNG-7154](https://issues.apache.org/jira/browse/MNG-7154?redirect=false)** and commented

Where maven has shortcomings, I tend to introduce a separate compile phase and use the "pre-compiled" class via the exec plugin to extend the build process. That's waaaay easier than maintaining a separate plugin, though, of course, very limited regarding maven internals. It would be great to have a standardized way to do this and have additional capabilities like access to the build data and build listeners via annotations.

One possibility would be to introduce a reserved package space, ie. "build.**" that would not be included in the final package by default. Instead it would be annotation-scanned and treated somewhat like a webapp container, but adjusted to the maven build context.

Methods in those classes could be annotated with something like `@BuildExecutionListener` and then decide on their own to execute code before or after plugin executions. A `@BuildConfig` annotation could provide access to maven build data. A `@Repository` annotation could provide access to .m2 contents. Essentially something close to a build-oriented AOP solution.

---

**Affects:** 3.8.1

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.