Generating Java classes from XSD maven dependency in maven with JAXB (or others) -


i have data model stored in maven repo xsd file. goal create jar java classes representing model. want use maven , jaxb this. know maven-jaxb2-plugin (codehouse-mojo , java-net, not sure yet how differ) don't see way use xsd maven dependency input. have write own plugin this?

it doesn't have jaxb if there better tool it.

disclaimer: i'm author of maven-jaxb2-plugin.

check documentation, it's right there. see specifying compile - specifying urls, filesets , maven artifact resources.

example:

<configuration>                                                                                              <schemas>                                                                                                <!--             compiles schema resides             in maven artifact.         -->         <schema>                                                                                             <dependencyresource>                                                                             <groupid>org.jvnet.jaxb2.maven2</groupid>                                                <artifactid>maven-jaxb2-plugin-tests-po</artifactid>                                     <!-- can defined in project dependencies or dependency management -->                 <version>${project.version}</version>                                                    <resource>purchaseorder.xsd</resource>                                               </dependencyresource>                                                                    </schema>                                                                                     </schemas>                                                                                       </configuration> 

you can use catalogs rewrite schema urls maven artifact resources.

example:

rewrite_system "http://schemas.opengis.net" "maven:org.jvnet.ogc:ogc-schemas:jar::!/ogc" 

this rewrite uri http://schemas.opengis.net/ows/2.0/owsall.xsd maven:org.jvnet.ogc:ogc-schemas:jar::!/ogc/ows/2.0/owsall.xsd. reference ogc/ows/2.0/owsall.xsd resource in ogc-schemas jar artifact.

as far know, these features unique maven-jaxb2-plugin.


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -