0

这个问题与这个问题非常相似,但我的情况有点不同

我有一个包含许多 xsd 和 wsdl 的目录。其中一些需要生成到不同的包中。

我已将我的 pom.xml 配置如下:

    <plugin>
            <groupId>org.jvnet.jaxb2.maven2</groupId>
            <artifactId>maven-jaxb2-plugin</artifactId>
            <version>0.7.1</version>
            <executions>
                <execution>
                    <id>xsd-generate</id>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                    <configuration>
                        <generateDirectory>${project.build.directory}/generated-sources/xsdClasses</generateDirectory>
                        <generatePackage>eu.ist_phosphorus.harmony.common.serviceinterface.databinding.jaxb</generatePackage>
                        <schemaDirectory>resources/webservices</schemaDirectory>
                        <includeSchemas>
                            <!-- we have 3 top level xsd's -->
                            <include>Topology-Types.xsd</include>
                            <include>Reservation-Types.xsd</include>
                            <include>Notification-Types.xsd</include>

                        </includeSchemas>
                        <extension>true</extension>
                        <args>
                            <arg>-Xcopyable</arg> <!-- to make them implement java.lang.Cloneable -->
                        </args>
                        <plugins>
                            <!-- necesary for -Xcopyable to work -->
                            <plugin>
                                <groupId>org.jvnet.jaxb2_commons</groupId>
                                <artifactId>jaxb2-basics</artifactId>
                                <version>0.5.3</version>
                            </plugin>
                        </plugins>
                    </configuration>
                </execution>

                <execution>
                    <id>wsdl-reservation-generate</id>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                    <configuration>
                        <generateDirectory>${project.build.directory}/generated-sources/reservationClasses</generateDirectory>
                        <generatePackage>eu.ist_phosphorus.harmony.common.serviceinterface.reservation</generatePackage>
                        <schemaDirectory>resources/webservices/</schemaDirectory>
                        <includeSchemas>
                            <include>Reservation-WS.wsdl</include>
                        </includeSchemas>
                        <extension>true</extension>
                    </configuration>
                </execution>

                <execution>
                    <id>wsdl-notification-generate</id>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                    <configuration>
                        <generateDirectory>${project.build.directory}/generated-sources/notificationClasses</generateDirectory>
                        <generatePackage>eu.ist_phosphorus.harmony.common.serviceinterface.notification</generatePackage>
                        <schemaDirectory>resources/webservices</schemaDirectory>
                        <includeSchemas>
                            <include>Notification-WS.wsdl</include>
                        </includeSchemas>
                        <extension>true</extension>
                    </configuration>
                </execution>

                <execution>
                    <id>wsdl-topology-generate</id>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                    <configuration>
                        <generateDirectory>${project.build.directory}/generated-sources/topologyClasses</generateDirectory>
                        <generatePackage>eu.ist_phosphorus.harmony.common.serviceinterface.topology</generatePackage>
                        <schemaDirectory>resources/webservices</schemaDirectory>
                        <includeSchemas>
                            <include>Topology-WS.wsdl</include>
                        </includeSchemas>
                        <extension>true</extension>
                    </configuration>
                </execution>

            </executions>

        </plugin>

当我运行 mvn compile 生成类时,问题是每个生成的包都包含每个类,而不仅仅是我包含在 includeSchemas 中的那个。

如何配置插件,使每个包只包含 includeSchemas 中列出的类?

为什么我的情况与另一个问题不同?我不能将 xsd/wsdl 文件放在不同的目录中,因为它们依赖于额外的文件,我认为复制这些文件不是一个好主意

4

1 回答 1

1

I believe your problem is that <includeSchemas> should be <schemaIncludes> (at least with version 0.8.0)

于 2012-03-01T17:37:03.300 回答