jaxb2-maven-plugin只执行第一次执行 [英] jaxb2-maven-plugin only executing first execution

查看:290
本文介绍了jaxb2-maven-plugin只执行第一次执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用jaxb-maven插件使用JAXB将多个XSD转换为不同包中的POJO。我已将其设置为使用多个执行块,第一个执行块执行,然后我收到一条消息:在架构或绑定文件中未检测到任何更改

I'm trying to convert multiple XSDs to POJOs in different packages using JAXB using the jaxb-maven plugin. I've set it up to use multiple execution blocks, the first execution block executes, then I get a message saying: No changes detected in schema or binding files

这是来自我的pom.xml的摘录:

This is an extract from my pom.xml:

...
<build>
    <pluginManagement>
        <plugin> 
            <groupId>org.codehaus.mojo</groupId> 
            <artifactId>jaxb2-maven-plugin</artifactId> 
            <version>1.5</version> 
        </plugin>
    </pluginManagement>
    <plugins>
    <!-- JAXB GENERATOR PLUGIN -->
    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>jaxb2-maven-plugin</artifactId>
        <version>1.5</version>
        <executions>                    
        <execution>
            <id>Application0</id>
            <phase>generate-sources</phase>
            <goals>
            <goal>xjc</goal>
            </goals>
            <configuration>
            <schemaDirectory>src/main/webapp/WEB-INF/xsd/version1</schemaDirectory>
            <packageName>za.co.mycee.application.model</packageName>
            <outputDirectory>${basedir}/src/main/java/</outputDirectory>
            <clearOutputDir>false</clearOutputDir>
            <source>1.5</source>
            <target>2.1</target>
            <arguments>-no-header</arguments>
            </configuration>
        </execution>                
        <execution>
            <id>Application1</id>
            <phase>generate-sources</phase>
            <goals>
            <goal>xjc</goal>
            </goals>
            <configuration>
            <schemaDirectory>src/main/webapp/WEB-INF/xsd/version1</schemaDirectory>
            <packageName>za.co.mycee.application.model.version1</packageName>
            <outputDirectory>${basedir}/src/main/java/</outputDirectory>
            <clearOutputDir>false</clearOutputDir>
            <source>1.5</source>
            <target>2.1</target>
            <arguments>-no-header</arguments>
            </configuration>
        </execution>
        <execution>
            <id>Application2</id>
            <phase>generate-sources</phase>
            <goals>
            <goal>xjc</goal>
            </goals>
            <configuration>
            <schemaDirectory>src/main/webapp/WEB-INF/xsd/version2</schemaDirectory>
            <packageName>za.co.mycee.application.model.version2</packageName>
            <outputDirectory>${basedir}/src/main/java/</outputDirectory>
            <clearOutputDir>false</clearOutputDir>
            <source>1.5</source>
            <target>2.1</target>
            <arguments>-no-header</arguments>
            </configuration>
        </execution>        
        </executions>
    </plugin>
    ...
</build>
....

这是我收到的错误消息:

This is the error message I'm getting:

[INFO] --- jaxb2-maven-plugin:1.5:xjc (Application) @ mycee-application ---                                                                                                        
[INFO] Generating source...                                                                                                                                                  
[INFO] parsing a schema...                                                                                                                                                   
[INFO] compiling a schema...                                                                                                                                                 
[INFO] za/co/mycee/application/model/AddressType.java                                                                                                                          
[INFO] ...
[INFO] za/co/mycee/application/model/package-info.java                                                                                                                         
[INFO]
[INFO] --- jaxb2-maven-plugin:1.5:xjc (Application1) @ mycee-application ---
[INFO] No changes detected in schema or binding files - skipping source generation.
[INFO]
[INFO] --- jaxb2-maven-plugin:1.5:xjc (Application2) @ mycee-application ---
[INFO] No changes detected in schema or binding files - skipping source generation.

如果我交换执行块,第一个总是执行,我得到相同的消息剩下两个街区。

If I swap the execution blocks around, the first one always executes and I get the same message for the remaining two blocks.

关于如何解决这个问题的想法?

Any ideas on how to work around this?

推荐答案

通过升级到版本1.6来修复它

Fixed it by upgrading to version 1.6

<plugin> 
    <groupId>org.codehaus.mojo</groupId> 
    <artifactId>jaxb2-maven-plugin</artifactId> 
    <version>1.6</version> 
</plugin>

<!-- JAXB GENERATOR PLUGIN -->
<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>jaxb2-maven-plugin</artifactId>
    <version>1.6</version>
    ....

在版本1.6中修复,在版本1.5中,所有执行块都在使用相同的陈旧文件: http://jira.codehaus.org/browse/MJAXB-8

Fixed in version 1.6, in version 1.5 all execution blocks were using the same staleFile: http://jira.codehaus.org/browse/MJAXB-8

这篇关于jaxb2-maven-plugin只执行第一次执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆