I have a number of resources that return various XML objects. It
would be nice if the wadl indicated the real return types, so, in an
attempt to be clever, I created mime types for each of my xml root
objects, then set up resources to
@Produce("application/xml-my-widget").
This made the WADL look good, but jersey wanted me to create a unique
MessageBodyWriter for each one of those objects. Both the server and
client get messy.
I think the answer to this is extended wadl and provide a
@resource.xxx.representation for each one of these. So that's what
I'm attempting to do.
I have not been able to piece together a working maven configuration
for this. If I understand correctly then what I really need to is to
configure maven-javadoc-plugin to use resource-doclet, which should
cause it to produce a file
${project.build.outputDirectory}/resourcedoc.xml that contains hints
to the extended wadl generator at runtime. (Correct?)
I am using 1.4 for now. In my dependencies I load:
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.4</version>
</dependency>
as well as a number of other pieces (jersey-guice, etc.)
What I can't figure out is why when I go to build I get this:
"An error has occurred in JavaDocs report generation:Unable to find
artifact:groupId = 'com.sun.jersey' artifactId = 'jersey-server'
version = '1.4'"
Obviously, jersey-server is there because the rest of the project
builds just fine. It's in my local .m2 repository, everything looks
AOK.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>javadoc</goal>
</goals>
<phase>compile</phase>
</execution>
</executions>
<configuration>
<encoding>UTF-8</encoding>
<verbose>false</verbose>
<show>public</show>
<subpackages>com.sun.jersey.samples.generatewadl.resources</subpackages>
<doclet>com.sun.jersey.wadl.resourcedoc.ResourceDoclet</doclet>
<docletArtifacts>
<docletArtifact>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>wadl-resourcedoc-doclet</artifactId>
<version>1.4</version>
</docletArtifact>
<docletArtifact>
<groupId>com.sun.jersey</groupId> <!-- *** This is
where it is broken? *** -->
<artifactId>jersey-server</artifactId>
<version>1.4</version>
</docletArtifact>
<docletArtifact>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.6.1</version>
</docletArtifact>
</docletArtifacts>
<additionalparam>-output
${project.build.outputDirectory}/resourcedoc.xml</additionalparam>
<useStandardDocletOptions>false</useStandardDocletOptions>
</configuration>
</plugin>