我不理解official document。即使我按照这个例子,我仍然会收到错误。当我执行命令“mvn clean compile”时,会显示以下错误:
无法执行目标org.codehaus.mojo:jaxb2-maven-plugin:2.3.1:xjc (xjc)项目zTestJaxb :: MojoExecutionException: NoSchemasException - > [帮助1]
环境: mac,jdk8,eclipse Mars
项目目录
的pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com</groupId>
<artifactId>zTestJaxb</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<pluginManagement>
<plugins>
<!-- If we e.g. execute on JDK 1.7, we should compile for Java 7 to get
the same (or higher) JAXB API version as used during the xjc execution. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>2.3.1</version>
<executions>
<execution>
<id>xjc1</id>
<goals>
<goal>xjc</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- The package of your generated sources -->
<packageName>com</packageName>
</configuration>
</plugin>
</plugins>
</build>
答案 0 :(得分:2)
检查您的项目工作区配置为 JDK 或 JRE ,因为pom
目标设置为XJC
,XJC
将是出现在 java / Jdk / bin 中。如果你正在使用eclipse goto 首选项 - &gt; java - &gt; 已安装的JRE 此处添加JDK的路径。