java.lang.ClassNotFoundException: com.sun.codemodel.CodeWriter with JDK9

Switching to 2.5.0 for jaxb2-maven-plugin solved it for java 11.


You can try using jaxb2-maven-plugin 2.3.1 and putting <plugins> inside <pluginManagement> may work.

<pluginManagement>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                    <source>1.9</source>
                    <target>1.9</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jaxb2-maven-plugin</artifactId>
                <version>2.3.1</version>
                <executions>
                    <execution>
                        <id>xjc</id>
                        <goals>
                            <goal>xjc</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <xjbSources>
                        <xjbSource>conf/GlobalBindings.xjb</xjbSource>
                    </xjbSources>
                    <sources>
                        <source>conf/schema</source>
                    </sources>
                    <!-- Package name of the generated sources. <packageName>se.west</packageName> -->
                    <outputDirectory>src</outputDirectory>
                    <clearOutputDir>false</clearOutputDir>
                    <noGeneratedHeaderComments>true</noGeneratedHeaderComments>
                    <extension>true</extension>
                    <generateEpisode>false</generateEpisode>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>

Tags:

Java

Jaxb

Xjc