micronaut-projects / micronaut-maven-plugin

Maven plugin to execute Micronaut applications
https://micronaut-projects.github.io/micronaut-maven-plugin/latest/
Apache License 2.0
20 stars 19 forks source link

Generate factory class with bean imports from dependencies #1021

Closed auke- closed 4 months ago

auke- commented 4 months ago

We use the Bean Import functionality in to allow injection of beans from various (internal) libraries which don't depend on Micronaut (and thus do not have generated bean definition classes).

Since the imports are handled by an annotation processor which doesn't have access to the list of available packages each package has to be defined in the @Import annotation. This is however error prone as it is easy to forget to add a package when a new package is introduced in the library.

The Micronaut Import Maven Plugin was created to overcome this issue, it allows you to generate factory classes annotated with @Import for the matching packages from the dependencies. It would however be great to see this functionality in the Micronaut Maven (and Gradle) plugin.

Would you consider integrating such functionality in the Micronaut plugin?

graemerocher commented 4 months ago

Seems useful, would need a Gradle equivalent /cc @melix @alvarosanchez

alvarosanchez commented 4 months ago

@auke- sure thing, please create a PR and I will guide you from there. Thanks!