首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Mojo schemagen maven插件错误地生成类

Mojo schemagen maven插件错误地生成类
EN

Stack Overflow用户
提问于 2013-05-21 22:56:14
回答 1查看 1.2K关注 0票数 1

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

代码语言:javascript
复制
<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>
EN

回答 1

Stack Overflow用户

发布于 2013-07-23 14:58:45

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

我找到的解决方案是使用maven-resources-plugin2中的“copy-resources”目标,只包含.xsd文件。

代码语言:javascript
复制
        <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>

1 2

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16673130

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档