schemagen

Generating XML Schema from JAXB class files in Ant

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-21 19:49:13
问题 Is it possible to use the shemagen ant Task to generate an xsd schema from class files instead of from source? 回答1: You could probably write something fairly easily, and then call it from Ant: import java.io.File; import java.io.IOException; import javax.xml.bind.JAXBContext; import javax.xml.bind.SchemaOutputResolver; import javax.xml.transform.Result; import javax.xml.transform.stream.StreamResult; public class SchemaGenerator { public static void main(String[] args) throws Exception {

How do you invoke schemagen in Java 11?

我的未来我决定 提交于 2019-12-21 05:15:15
问题 According to Oracle documentation the schemagen tool is removed from the JDK as part of JEP 320 (http://openjdk.java.net/jeps/320). That JEP points to Maven artifacts that now supply the missing tools. The coordinates of the artifacts are wrong in the JEP, updated coordinates are found in an answer to this question: Which artifacts should I use for JAXB RI in my Maven project? What is missing however is how to invoke the tools. There are shell scripts pointed to in the JEP that are in the

Generating XML Schema from JAXB class files in Ant

丶灬走出姿态 提交于 2019-12-04 12:35:42
Is it possible to use the shemagen ant Task to generate an xsd schema from class files instead of from source? bdoughan You could probably write something fairly easily, and then call it from Ant: import java.io.File; import java.io.IOException; import javax.xml.bind.JAXBContext; import javax.xml.bind.SchemaOutputResolver; import javax.xml.transform.Result; import javax.xml.transform.stream.StreamResult; public class SchemaGenerator { public static void main(String[] args) throws Exception { String contextPath = args[0]; String outputDir = args[1]; JAXBContext jc = JAXBContext.newInstance

Generating XSD schemas from JAXB types in Maven?

本秂侑毒 提交于 2019-11-30 07:30:30
问题 I'm trying to basically generate XSD schemas from my model classes annotated in JAXB using a Maven plugin. Here's the relevant code in my POM: <plugin> <groupId>com.sun.tools.jxc.maven2</groupId> <artifactId>maven-jaxb-schemagen-plugin</artifactId> <version>1.2</version> <executions> <execution> <phase>generate-resources</phase> <goals> <goal>generate</goal> </goals> </execution> </executions> <configuration> <project>${project}</project> <destdir>${project.build.directory}/schemas</destdir>

How do you invoke schemagen in Java 11?

蹲街弑〆低调 提交于 2019-11-29 05:08:53
According to Oracle documentation the schemagen tool is removed from the JDK as part of JEP 320 ( http://openjdk.java.net/jeps/320 ). That JEP points to Maven artifacts that now supply the missing tools. The coordinates of the artifacts are wrong in the JEP, updated coordinates are found in an answer to this question: Which artifacts should I use for JAXB RI in my Maven project? What is missing however is how to invoke the tools. There are shell scripts pointed to in the JEP that are in the JAXB-RI Git repository. However those scripts remain undocumented and difficult to invoke. The build