Hi,
In the pom.xml
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<id>Generate XSD</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<echo message=" >
ANT : Generate XSD" />
<tasks>
<property
name="compile_classpath" refid="maven.compile.classpath" />
<java
classpath="${compile_classpath}"
classname="com.XXXX.XXX.rest.utils.GenerateXSD" fork="true" inputstring=""
maxmemory="512m">
</java>
</tasks>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-nodeps</artifactId>
<version>1.7.1</version>
</dependency>
</dependencies>
</plugin>
And the Class Generate XSD
public final class GenerateXSD {
private GenerateXSD() {
}
/**
* Will launch XSD generation using ant-run maven plugin
*
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
System.out.println("Start generation XSD : " +
MySchemaOutputResolver.getBaseDir()
+
MySchemaOutputResolver.getOutPutFileNAme());
String publicPkg = null;
String privatePkg = null;
for (String arg : args) {
if (arg.startsWith("public:")) {
publicPkg =
arg.substring("public:".length());
}
if (arg.startsWith("private:")) {
privatePkg =
arg.substring("private:".length());
}
}
JAXBContextResolver jaxbContextResolver = new
JAXBContextResolver(publicPkg, privatePkg);
JAXBContext context =
JAXBContext.newInstance(jaxbContextResolver.getPublicTypes().toArray(
new
Class[jaxbContextResolver.getPublicTypes().size()]));
context.generateSchema(new MySchemaOutputResolver());
System.out.println("END generation XSD");
}
}
-----Original Message-----
From: Christopher Piggott [mailto:cpiggott_at_gmail.com]
Sent: Friday, December 31, 2010 8:18 AM
To: users_at_jersey.java.net
Subject: [Jersey] maven-jaxb-schemagen -> extended wadl
Does anybody know if it would be possible to set up a pom to do this:
http://jaxb.java.net/maven-jaxb-schemagen/generate-mojo.html
to generate schema from my classes, and have THAT feed the extended WADL
doclet to produce a complete WADL?
The problem I have is that I'm not starting with schema, I'm starting with
beans. Currently I only use:
generator( WadlGeneratorResourceDocSupport.class ).prop(
"resourceDocStream", "resourcedoc.xml" )
This gives me something useful, but obviously it would be far more useful if
it contained the type information as well.