Skip to content

MuzzleCodeGenerationPlugin is not a proper Byte Buddy plugin #13611

Open
@kriegaex

Description

@kriegaex

Is your feature request related to a problem? Please describe.

The API docs for net.bytebuddy.build.Plugin say, among other things:

Plugin types must be public, non-abstract and must declare a public default constructor to work.

MuzzleCodeGenerationPlugin does not declare any default constructor, only a custom one accepting a URLClassLoader argument. I.e., the plugin neither works from Byte Buddy (BB) Maven nor BB Gradle plugin, only from the custom Gradle plugin. Otherwise, it would easily be possible to use the regular BB plugins, no custom plugin would be necessary. The apply interface method accepts 3 parameters, among them a ClassFileLocator which is completely ignored by MuzzleCodeGenerationPlugin in favour of the URLClassLoader.

Describe the solution you'd like

I suggest to refactor the plugin into something using BB infrastructure es intended, which in the end would mean less code to maintain (no more custom build plugin but the default BB build plugins for Maven and Gradle calling the BB plugin implementation via normal parametrisation). The build process for extensions would be closer to the standard BB provides infrastructure for, and on top of Gradle Maven would be supported out of the box.

Describe alternatives you've considered

No response

Additional context

See this related Stack Overflow question which I have answered, describing workarounds for Maven.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestneeds triageNew issue that requires triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions