<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>2.5.0</version>
<executions>
<execution>
<id>schemagen</id>
<goals>
<goal>schemagen</goal>
</goals>
</execution>
</executions>
<configuration>
<sources>
<source>你的java类的路径</source>
</sources>
<outputDirectory>src/main/resources</outputDirectory>
<clearOutputDir>false</clearOutputDir>
<transformSchemas>
<transformSchema>
<uri>/jaxb/gen</uri>
<toPrefix>user</toPrefix>
<toFile>user-gen.xsd</toFile>
</transformSchema>
</transformSchemas>
</configuration>
</plugin>
这样就可以将Java类转换成xsd了。
下面是wsdl转xsd的思路!
wsdl转java代码再讲java转xsd。
上面是java转xsd。
下面是wsdl转java
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.14.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<schemaLanguage>WSDL</schemaLanguage>
<generatePackage>server.peking.orderly.charging.webservice.modules.open.api.cdy.com</generatePackage>
<schemas>
<schema>
<url>file:///D:/WSDL的文件路径</url>
</schema>
</schemas>
</configuration>
</plugin>
这个url里面可以放网站。
通过这种方式将wsdl转成java,
结合上面的操作就可以实现wsdl转xsd了