maven-jaxb2-plugin在构建后立即删除类

时间:2013-03-03 19:02:52

标签: maven maven-2 jaxb jaxb2 maven-jaxb2-plugin

我正在尝试使用maven-jaxb2 plugin生成一些类。但是每次构建后几秒钟,类都会从target/generated-resources文件夹中删除(但它们仍然在target/classes/...文件夹中)

这是我的pom中的插件定义:

<plugin>
    <groupId>org.jvnet.jaxb2.maven2</groupId>
    <artifactId>maven-jaxb2-plugin</artifactId>
    <version>0.8.1</version>
    <executions>
        <execution>
            <goals>
                <goal>generate</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <cleanPackageDirectories>true</cleanPackageDirectories>
        <generatePackage>gen.name.integrationimpl.imdb.types</generatePackage>
        <schemaDirectory>${basedir}/src/main/resources</schemaDirectory>
        <args>
            <param>-npa</param>
        </args>
        <removeOldOutput>true</removeOldOutput>
        <includeSchemas>
            <includeSchema>**/*.xsd</includeSchema>
        </includeSchemas>
    </configuration>
    <dependencies>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.2.5-b10</version>
        </dependency>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.2.6</version>
        </dependency>
        <dependency>
            <groupId>javax.activation</groupId>
            <artifactId>activation</artifactId>
            <version>1.1.1</version>
        </dependency>
        <dependency>
            <groupId>javax.xml.stream</groupId>
            <artifactId>stax-api</artifactId>
            <version>1.0-2</version>
        </dependency>
    </dependencies>
</plugin>

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <version>1.7</version>
    <executions>
        <execution>
            <id>add-resource</id>
            <phase>generate-resources</phase>
            <goals>
                <goal>add-resource</goal>
            </goals>
            <configuration>
                <resources>
                    <resource>
                        <directory>src/main/resources</directory>
                        <targetPath>resources-target</targetPath>
                    </resource>
                </resources>
            </configuration>
        </execution>
    </executions>
</plugin>

我的xsd应该是对的。

我不知道出了什么问题。我以前做了几次,但从来没有这个问题。

感谢您的帮助

1 个答案:

答案 0 :(得分:1)

对于那些感兴趣的人:我通过删除

暂时解决了它
<removeOldOutput>true</removeOldOutput>

标签