I ran into a lot of problems when using jaxb in Maven, but I managed to solve your problem by doing the following
First create a schema.xjc file
<?xml version="1.0" encoding="UTF-8"?> <jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xsd="http://www.w3.org/2001/XMLSchema" jaxb:version="2.0"> <jaxb:bindings schemaLocation="YOUR_URL?wsdl#types?schema1"> <jaxb:schemaBindings> <jaxb:package name="your.package.name.schema1"/> </jaxb:schemaBindings> </jaxb:bindings> <jaxb:bindings schemaLocation="YOUR_URL??wsdl#types?schema2"> <jaxb:schemaBindings> <jaxb:package name="your.package.name.schema2"/> </jaxb:schemaBindings> </jaxb:bindings> </jaxb:bindings>
A package name can be anything you want if it does not contain reserved keywords in Java
Then you need to create a wsimport.bat script in order to generate your package and code in your preferred location.
cd C:\YOUR\PATH\TO\PLACE\THE\PACKAGES wsimport -keep -verbose -b "C:\YOUR\PATH\TO\schema.xjb" YOUR_URL?wsdl pause
If you do not want to use cd, you can put the wsimport.bat file in the folder "C: \ YOUR \ PATH \ TO \ PLACE \ THE \ PACKAGES"
If you run it without -keep -verbose, it will only generate packages, but not .java files.
-b will verify that schema.xjc is used when generating
Glenn Van Schil Sep 22 '15 at 9:17 2015-09-22 09:17
source share