Empty lines in generated XSD

I’m trying to generate schema files from some Java classes using jaxb2-maven-plugin(version 2.5.0). I’m getting the schema1.xsd file without any warnings, but it contains extra empty lines:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0">

  <xs:complexType name="sampleRequest">

    <xs:sequence>

      <xs:element minOccurs="0" name="someField" type="xs:string"/>

    </xs:sequence>

  </xs:complexType>

</xs:schema>

I couldn’t find out any reason or a way to configure this behavior(http://www.mojohaus.org/jaxb2-maven-plugin/Documentation/v2.2/schemagen-mojo.html). I’m using pretty simple configuration so far:

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxb2-maven-plugin</artifactId>
            <version>2.5.0</version>
            <executions>
                <execution>
                    <goals>
                        <goal>schemagen</goal>
                    </goals>
                    <phase>generate-resources</phase>
                    <configuration>
                        <includes>
                            <include>path/to/my/package/*.java</include>
                        </includes>
                        <outputDirectory>${project.build.directory}/schemas</outputDirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>

Am I doing something wrong or is there any way to configure the output? I don’t think that’s an encoding issue since there are actually some indenting spaces on the blank lines, not just line breaks:

enter image description here

I’m using JDK 11

Leave a Reply

avatar
  Subscribe  
Notify of