jaxb2-maven-plugin 不生成包-info.java

jaxb2-maven-plugin not generating package-info.java

对于所有给定的 XSD,jaxb2-maven-plugin 不会生成 package-info.java 文件。 (它只生成 类)。我们还是用Java 1.8

我的 pom 看起来像这样:

           <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxb2-maven-plugin</artifactId>
            <version>2.3.1</version>
            <configuration>
                <locale>en</locale>
                <outputDirectory>${project.build.directory}/generated-sources/jaxb</outputDirectory>
                <extension>true</extension>
                <encoding>UTF-8</encoding>
                <target>2.1</target>
                <verbose>false</verbose>
                <clearOutputDir>false</clearOutputDir>
                <extension>true</extension>
                <noGeneratedHeaderComments>true</noGeneratedHeaderComments>
                <generateEpisode>false</generateEpisode>
                <addGeneratedAnnotation>true</addGeneratedAnnotation>
                <xjbSources>
                    <xjbSource>res/bindings.xml</xjbSource>
                </xjbSources>
                <noPackageLevelAnnotations>false</noPackageLevelAnnotations>
            </configuration>
            <executions>
                <execution>
                    <id>services</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>xjc</goal>
                    </goals>
                    <configuration>
                        <packageName>common.input.services</packageName>
                        <sources>
                            <source>${project.basedir}/src/main/xsd/ServiceCatalogue.xsd</source>
                        </sources>
                    </configuration>
                </execution>
...

有什么想法吗?

您的 ServiceCatalogue.xsd 没有在 <xsd> 根元素中使用 targetNamespacexmlns 属性声明目标命名空间。

例如:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
  xmlns="https://whosebug.com/ServiceCatalogue.xsd"
  targetNamespace="https://whosebug.com/ServiceCatalogue.xsd"
>
....
</xsd>