Mojo schemagen maven插件错误地生成类

Mojo schemagen maven插件错误地生成类,maven,plugins,pom.xml,jaxb2,schemagen,Maven,Plugins,Pom.xml,Jaxb2,Schemagen,各位早上好,, 我正在尝试在我的应用程序中使用mojo jaxb2 maven插件,但是只要正确创建模式,它就会在同一文件夹中生成整个类(作为.class)。 我想说,出于某种原因,maven/编译器正在/schemas/文件夹中创建输出类。 关键是我只想输出将在其他项目中使用的*.xsd文件。 以下是我的pom摘录: <plugins> <plugin> <groupId>org.codehaus.mo

各位早上好,, 我正在尝试在我的应用程序中使用mojo jaxb2 maven插件,但是只要正确创建模式,它就会在同一文件夹中生成整个类(作为.class)。 我想说,出于某种原因,maven/编译器正在/schemas/文件夹中创建输出类。 关键是我只想输出将在其他项目中使用的*.xsd文件。 以下是我的pom摘录:

<plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jaxb2-maven-plugin</artifactId>
                <version>1.5</version>
                <executions>
                    <execution>
                        <phase>generate-resources</phase>
                        <id>schemagen</id>
                        <goals>
                            <goal>schemagen</goal>
                        </goals>
                        <configuration>
                            <includes>
                                <include>com/delagelanden/rijee6/domain/*.java</include>
                            </includes>
                            <outputDirectory>${project.build.directory}/schemas</outputDirectory>
                             <verbose>true</verbose>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>

org.codehaus.mojo
jaxb2 maven插件
1.5
产生资源
schemagen
schemagen
com/delagelanden/rijee6/domain/*.java
${project.build.directory}/schemas
真的

这里有人问了同样的问题[1],这似乎是一个悬而未决的问题

我找到的解决方案是使用maven resources插件[2]的“复制资源”目标,只包括.xsd文件

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxb2-maven-plugin</artifactId>
            <version>1.5</version>
            <executions>
                <execution>
                    <id>schemagen</id>
                    <goals>
                        <goal>schemagen</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <includes>
                    <include>**/*.java</include>
                </includes>
                <outputDirectory>${project.build.directory}/generated-resources/schemas</outputDirectory>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.6</version>
            <executions>
                <execution>
                    <id>copy-resources</id>
                    <phase>process-resources</phase>
                    <goals>
                        <goal>copy-resources</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${project.build.outputDirectory}/META-INF/schema</outputDirectory>
                        <resources>
                            <resource>
                                <directory>${project.build.directory}/generated-resources/schemas</directory>
                                <includes>
                                    <include>**/*.xsd</include>
                                </includes>
                            </resource>
                        </resources>
                    </configuration>
                </execution>
            </executions>
        </plugin>

org.codehaus.mojo

[2] 这里有人问了同样的问题[1],这似乎是一个悬而未决的问题

我找到的解决方案是使用maven resources插件[2]的“复制资源”目标,只包括.xsd文件

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxb2-maven-plugin</artifactId>
            <version>1.5</version>
            <executions>
                <execution>
                    <id>schemagen</id>
                    <goals>
                        <goal>schemagen</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <includes>
                    <include>**/*.java</include>
                </includes>
                <outputDirectory>${project.build.directory}/generated-resources/schemas</outputDirectory>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.6</version>
            <executions>
                <execution>
                    <id>copy-resources</id>
                    <phase>process-resources</phase>
                    <goals>
                        <goal>copy-resources</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${project.build.outputDirectory}/META-INF/schema</outputDirectory>
                        <resources>
                            <resource>
                                <directory>${project.build.directory}/generated-resources/schemas</directory>
                                <includes>
                                    <include>**/*.xsd</include>
                                </includes>
                            </resource>
                        </resources>
                    </configuration>
                </execution>
            </executions>
        </plugin>

org.codehaus.mojo
[2]