【问题标题】:No JAXB Classes Generated from xsd using Maven Plugin没有使用 Maven 插件从 xsd 生成的 JAXB 类
【发布时间】:2012-11-02 20:59:03
【问题描述】:

我无法看到使用 jaxb2-maven-plugin 从我的 xsd 生成的任何 jaxb 类

    <bulid>
    <pluginManagement>
    <plugins>
        <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>jaxb2-maven-plugin</artifactId>
        <version>1.5</version>
        <executions>
            <execution>
                <phase>generate-sources</phase>
                <goals>
                    <goal>generate</goal>
                </goals>
            </execution>
        </executions>
        <configuration>

            <schemaDirectory>src/main/xsd</schemaDirectory>
<sourceGenerationDirectory>target/sources</sourceGenerationDirectory>
<classGenerationDirectory>target/classes</classGenerationDirectory>
        </configuration>
        </plugin>
    </plugins>
    </pluginManagement>
    </bulid>
    <dependencies>
    <dependency>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>jaxb2-maven-plugin</artifactId>
        <version>1.5</version>
    </dependency>

我通过给予来运行我的 pom 干净安装生成:生成是正确的方法吗?请提出一种生成 jaxb 类的方法

我什至尝试通过 mvn generate-sources 运行,但没有生成任何东西

【问题讨论】:

  • 请在上面找到我尝试过的内容
  • 嗯,我认为问题已经改变了。以前你在问如何。现在,在编辑之后,您似乎知道如何操作,但解决方案不起作用......只是猜测,因为您没有评论解决方案的结果。有什么错误吗?
  • 没有为 perfix 'generate' 找到插件得到这样的结果
  • 1) 不要将插件添加为依赖项... 2) 阅读并理解此处的所有内容:confluence.highsource.org/display/MJIIP/User+Guide 3) 自己再试一次 4) 回来再问。干杯

标签: java maven maven-jaxb2-plugin jaxb2-maven-plugin


【解决方案1】:

我刚刚将我的目标更改为 xjc 和 mvn jaxb2:xjc 它工作了我能够生成 jxb 类

【讨论】:

    【解决方案2】:

    这在某个时间点对我有用;你可以在那里工作:

    <plugin>
        <groupId>com.sun.tools.xjc.maven2</groupId>
        <artifactId>maven-jaxb-plugin</artifactId>
        <version>1.1</version>
        <executions>
            <execution>
                <goals>
                    <goal>generate</goal>
                </goals>
            </execution>
        </executions>
        <configuration>
            <removeOldOutput>false</removeOldOutput>
            <schemaDirectory>src/main/resources/xsd</schemaDirectory>
            <includeBindings>
                <includeBinding>*.xjb</includeBinding>
            </includeBindings>
        </configuration>
    </plugin>
    

    插件绑定到generate-sources阶段。

    干杯,

    【讨论】:

    • 我厌倦了你让我什么都不做的东西正在目标文件夹下生成..
    • 编辑您的原始问题并粘贴到 maven 为您提供的任何相关输出中,否则我们真的无法帮助您...
    • 我现在改变了我的问题,请提出一个方法
    猜你喜欢
    • 2015-06-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-29
    • 1970-01-01
    • 2012-07-12
    相关资源
    最近更新 更多