13
与jOOQ,我可能想结合使用jOOQ code generator with Maven和custom generator strategy。看起来好像可以这样做(省略不相关的部分):如何通过jOOQ代码生成器和Maven使用自定义策略?
<plugin>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<version>2.2.2</version>
<!-- The plugin should hook into the generate goal -->
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<generator>
<name>org.jooq.util.DefaultGenerator</name>
<!-- But the custom strategy is not yet compiled -->
<strategy>
<name>com.example.MyStrategy</name>
</strategy>
</generator>
</configuration>
</plugin>
上述配置描述了这个问题。 jOOQ的代码生成器挂钩了Maven生命周期的生成目标,该目标发生在生命周期的编译目标之前。但是,对于代码生成,它需要一个预编译的自定义策略类,否则我将得到一个ClassNotFoundException
。 Maven如何解决这个问题?在执行generate
目标之前,我可以编译一个类吗?