英文:
How to give the address of jooq generators custom strategy, while loading the configuration from xml file?
问题
我正在从文件中加载 jooq 配置,并且我有一个自定义生成器设置,如下所示:
<generator>
<name>gen.generator.myGenerator</name>
<strategy>
<name>gen.generator.myGeneratorStrategy</name>
</strategy>
.
.
</generator>
我正在从我的原始项目的子项目中加载我的策略。
但问题是,如何引用我的策略?因为我遇到了 java.lang.ClassNotFoundException 的错误。
英文:
I am loading jooq configuration from a file and I have a custom generator setting like this:
<generator>
<name>gen.generator.myGenerator</name>
<strategy>
<name>gen.generator.myGeneratorStrategy</name>
</strategy>
.
.
</generator>
I am loading my strategy from a sub-project of my original project.
but the question is, how to address my strategy? because I get java.lang.ClassNotFoundException
答案1
得分: 0
您的GeneratorStrategy
需要出现在代码生成器的类路径中。这意味着您必须确保将包含策略的子项目添加为您的项目的依赖,或者至少添加到jooq-codegen-maven
插件中,例如
<plugin>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<executions>...</executions>
<dependencies>
<dependency>
<groupId>com.example</groupId>
<artifactId>my-subproject-containing-the-strategy</artifactId>
<version>${my-subproject-version}</version>
</dependency>
</dependencies>
</plugin>
英文:
Your GeneratorStrategy
needs to be on the classpath of your code generator. This means you have to make sure you add your sub-project containing the strategy as a dependency to your project, or at least to the jooq-codegen-maven
plugin, e.g.
<plugin>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<executions>...</executions>
<dependencies>
<dependency>
<groupId>com.example</groupId>
<artifactId>my-subproject-containing-the-strategy</artifactId>
<version>${my-subproject-version}</version>
</dependency>
</dependencies>
</plugin>
专注分享java语言的经验与见解,让所有开发者获益!
评论