JAXB2导入:无法处理架构文件(28分钟Udemy)

当我尝试添加JAXB2插件时,在<exception>行上出现"无法处理架构文件"错误...

pom.xml

    <plugins>
        <!-- JAXB2 Maven Plugin -->
        <!-- XSD Source Folder -->
        <!-- Java Class Source Folder -->
        <!-- clear folder -> false -->
    <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxb2-maven-plugin</artifactId>
            <version>1.6</version>
            <executions>
                <execution>
                    <id>xjc</id>
                    <goals>
                        <goal>xjc</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <schemaDirectory>${project.basedir}/src/main/resources</schemaDirectory>
                <outputDirectory>${project.basedir}/src/main/java</outputDirectory>
                <clearOutputDir>false</clearOutputDir>
            </configuration>
        </plugin>
    </plugins>

错误屏幕截图:


解决方案

对我来说,这个问题是通过保留如下<plugins></plugins> content inside <pluginManagement>标签来解决的,

<build>
<pluginManagement>
    <plugins> 
          <plugin>
           ...
          </plugin>
          <plugin>
           ...
          </plugin>
     </plugins>
</pluginManagement>
</build>

相关文章