Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I had the same problem: was using RESTeasy and wanted to find a way to generate the WADL automatically.</p> <p>Did some research and came to the solution below.</p> <h1>1. Add this to your <code>pom.xml</code>:</h1> <pre><code>&lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;com.sun.jersey.contribs&lt;/groupId&gt; &lt;artifactId&gt;maven-wadl-plugin&lt;/artifactId&gt; &lt;version&gt;1.17&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;generate&lt;/id&gt; &lt;goals&gt; &lt;goal&gt;generate&lt;/goal&gt; &lt;/goals&gt; &lt;phase&gt;${javadoc-phase}&lt;/phase&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;configuration&gt; &lt;wadlFile&gt;${project.build.outputDirectory}/application.wadl &lt;/wadlFile&gt; &lt;formatWadlFile&gt;true&lt;/formatWadlFile&gt; &lt;baseUri&gt;http://example.com:8080/rest&lt;/baseUri&gt; &lt;packagesResourceConfig&gt; &lt;param&gt;com.example.rs.resource&lt;/param&gt; &lt;/packagesResourceConfig&gt; &lt;wadlGenerators&gt; &lt;wadlGeneratorDescription&gt; &lt;className&gt;com.sun.jersey.server.wadl.generators.WadlGeneratorApplicationDoc &lt;/className&gt; &lt;properties&gt; &lt;property&gt; &lt;name&gt;applicationDocsFile&lt;/name&gt; &lt;value&gt;${basedir}/src/main/doc/application-doc.xml&lt;/value&gt; &lt;/property&gt; &lt;/properties&gt; &lt;/wadlGeneratorDescription&gt; &lt;wadlGeneratorDescription&gt; &lt;className&gt;com.sun.jersey.server.wadl.generators.WadlGeneratorGrammarsSupport &lt;/className&gt; &lt;properties&gt; &lt;property&gt; &lt;name&gt;grammarsFile&lt;/name&gt; &lt;value&gt;${basedir}/src/main/doc/application-grammars.xml&lt;/value&gt; &lt;/property&gt; &lt;/properties&gt; &lt;/wadlGeneratorDescription&gt; &lt;/wadlGenerators&gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; </code></pre> <p>Pay attention to the <code>buildUri</code> and <code>packagesResourceConfig</code> elements. You have to change them to reflect your project's configuration. You may also want to change the plugin's version (I used 1.17).</p> <h1>2. Create a /doc folder and add some files.</h1> <p>Create the <code>src/main/doc/</code> folder and create the two files below.</p> <p>File: <strong>application-doc.xml</strong></p> <p>Content:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;applicationDocs targetNamespace="http://wadl.dev.java.net/2009/02"&gt; &lt;doc xml:lang="en" title="A message in the WADL"&gt;This is added to the start of the generated application.wadl&lt;/doc&gt; &lt;/applicationDocs&gt; </code></pre> <p>File: <strong>application-grammars.xml</strong></p> <p>Content:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt; &lt;grammars xmlns="http://wadl.dev.java.net/2009/02" /&gt; </code></pre> <h1>3. Run the maven command.</h1> <p>Go to the project folder and run the following command:</p> <pre><code>$ mvn compile com.sun.jersey.contribs:maven-wadl-plugin:generate </code></pre> <p>The files <code>\target\classes\application.wadl</code> (the WADL itself) and <code>\target\classes\xsd0.xsd</code> (the schema of the resources - it's used by the application.wadl) should be generated.</p> <p>Edit and use them as you wish.</p> <p>PS.: Bear in mind that this is a very simple use of the maven-wadl-plugin. It can do a lot more. To know it better, please refer to the zip file mentioned in the other answer (by Pavel Bucek).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload