我正在使用 jaxb2-maven-plugin 从 jaxb 注释类生成 XSD。
配置看起来像这样
<execution>
<id>rest-api-execution-schemagen</id>
<goals>
<goal>schemagen</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<sources>
<source>src/java/foo/rest/execution/model</source>
</sources>
<outputDirectory>${project.build.directory}/execution-api-xml-schema</outputDirectory>
</configuration>
</execution>
包 foo/rest/execution/model 包含许多类,这就是为什么我希望避免将它们全部列在单独的<source>
元素中。相反,我指定我希望src/java/foo/rest/execution/model
使用单个<source>
元素包含整个目录。
问题是有子包:
foo/rest/execution/model/builder
...其中包含未注释 jaxb 且不应成为架构的一部分的其他类。不幸的是,schemagen 目标尝试递归遍历 foo/rest/execution/model 目录,因此尝试为子目录中的类生成模式。
有没有办法避免这种情况?