简体   繁体   中英

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

for all given XSDs, the jaxb2-maven-plugin does not generate the package-info.java file. (it only generates the classes). We still use Java 1.8

My pom looks like this:

           <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>
...

Any ideas?

Your ServiceCatalogue.xsd does not declare a target namespace using targetNamespace and xmlns attributes in <xsd> root element.

For Example:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM