[英]Getting Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:1.6:xjc (default-cli)
I have an XSD file and I'm trying to generate jaxb classes for that using jaxb2-maven plugin, the problem I generate the classes running the command mvn jaxb2:xjc
in command line.我有一个 XSD 文件,我正在尝试使用 jaxb2-maven 插件为其生成 jaxb 类,问题是我在命令行中生成运行命令mvn jaxb2:xjc
的类。 If I run the same command as goal in run configuration in eclipse I get如果我在 eclipse 的运行配置中运行与目标相同的命令,我会得到
Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:1.6:xjc (default-cli)无法执行目标 org.codehaus.mojo:jaxb2-maven-plugin:1.6:xjc (default-cli)
If I only run mvn clean package install
the classes are not getting generated.如果我只运行mvn clean package install
则不会生成类。 What am I doing wrong?我究竟做错了什么?
Here is my part of pom.xml:这是我的 pom.xml 部分:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<goals>
<goal>xjc</goal>
</goals>
</execution>
</executions>
<configuration>
<schemaDirectory>${project.basedir}/src/main/resources</schemaDirectory>
<schemaFiles>Trans.xsd</schemaFiles>
</configuration>
</plugin>
Please add a phase
element in your execution
configuration like this :请在您的execution
配置中添加一个phase
元素,如下所示:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<goals>
<goal>xjc</goal>
</goals>
<phase>validate</phase>
</execution>
</executions>
<configuration>
<schemaDirectory>${project.basedir}/src/main/resources</schemaDirectory>
<schemaFiles>Trans.xsd</schemaFiles>
</configuration>
</plugin>
By doing that, your maven will execute the xjc
goal when validating your project通过这样做,您的 Maven 将在验证您的项目时执行xjc
目标
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.