Reputation: 2539
this question is very similar to this one but my case is a bit different
I have a single directory which contains many xsd and wsdl. some of these need to be generated into different packages.
I have configured my pom.xml as following:
<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>
when I run mvn compile the classes are generated, the problem is that every generated package contains every single class, and not just the one I included wih includeSchemas.
how can I configure the plugin so that every package contains only the classes listed in includeSchemas?
why is my case different to the other question? I cannot put the xsd/wsdl files in different directories since them depend in extra files which I do not think is a good idea to duplicate
Upvotes: 0
Views: 5952
Reputation: 2641
I believe your problem is that <includeSchemas>
should be <schemaIncludes>
(at least with version 0.8.0)
Upvotes: 1