この質問はこれと非常に似ていますが、私の場合は少し異なります
多くの 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 ファイルを別のディレクトリに配置することはできません。これらのファイルは、複製することをお勧めしない余分なファイルに依存しているためです。