Code generation in Maven

后端 未结 3 1297
攒了一身酷
攒了一身酷 2021-02-13 22:53

I want to autogenerate some java classes from interfaces. My first thought was to write a code generator, and integrate it as a maven plugin.

I was thinking of creating

3条回答
  •  不要未来只要你来
    2021-02-13 23:31

    Sources should go in {project.build.directory}/generated-sources/[plugin-id]/

    Most plugins take configuration passed through the plugin configuration section in the pom. You can use default values as well, or an annotation and classpath scanning.

    A plugin like the maven-jspc-plugin generates code, which you could take a look at. The "Better Builds With Maven" e-book also contains a reasonably comprehensive chapter on writing plugins.

提交回复
热议问题