简体   繁体   English

无法执行目标 org.codehaus.mojo:jaxb2-maven-plugin:1.6:xjc (default-cli)

[英]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.

相关问题 无法执行目标 org.codehaus.mojo:exec-maven-plugin:3.0.0:exec (default-cli) - Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0:exec (default-cli) 无法执行目标org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy(default-cli) - Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy (default-cli) 无法在项目上执行目标org.codehaus.mojo:exec-maven-plugin:1.2.1:exec(default-cli):命令执行失败 - Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project: Command execution failed 无法在项目SpringData上执行目标org.codehaus.mojo:exec-maven-plugin:1.2.1:exec(default-cli) - Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project SpringData 无法在项目上执行目标org.codehaus.mojo:exec-maven-plugin:1.6.0:java(default-cli) <project-name> : - Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:java (default-cli) on project <project-name>: 为什么? ... 未能执行目标 org.codehaus.mojo:exec-maven-plugin:3.0.0:exec (default-cli) - Why? … Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0:exec (default-cli) 无法在项目 inv-project 上执行目标 org.codehaus.mojo:rpm-maven-plugin:2.0.1:rpm (default-cli) - Failed to execute goal org.codehaus.mojo:rpm-maven-plugin:2.0.1:rpm (default-cli) on project inv-project 无法在 NetBeans 中执行目标 org.codehaus.mojo:exec-maven-plugin:3.0.0:exec (default-cli) 的问题 - Promblem with Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0:exec (default-cli) in NetBeans 我尝试运行我的Maven项目时遇到错误:无法执行目标org.codehaus.mojo:exec-maven-plugin:1.2.1:exec(default-cli) - I have an error when i trying to run my maven project: Failed execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) JAVA如何修复错误&gt;无法在项目Sic桌面上执行目标org.codehaus.mojo:exec-maven-plugin:1.2.1:exec(default-cli): - JAVA how to fix error> Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project sic-desktop:
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM