I'm trying the maven-wadl-plugin
. (I didn't find any documentation besides the Javadoc .)
My project has the classes used for REST endpoints amongst different Maven modules. And the WADL plugin seems not to be able to reach for them. So running on a single module fails with:
[ERROR] Failed to execute goal
com.sun.jersey.contribs:maven-wadl-plugin:1.19.4:generate (generate)
on project bpds-resources: Execution generate of goal com.sun.jersey.contribs:maven-wadl-plugin:1.19.4:generate
failed: A required class was missing while executing
com.sun.jersey.contribs:maven-wadl-plugin:1.19.4:generate: com/.../common/dto/BoxRequestDto
The plugin doesn't support running from the root project either.
1) AFAIK, maven-wadl-plugin
parses the sources. My project results in a one big shaded .jar
so the plugin could consume that and not care about the internal dependencies. Can I make the plugin scan the artifact instead?
2) Is there a way to make it work over multiple projects?
I figured out that adding the project dependency to the scanned module works. So I have added the attribute with the DTO classes and now it works:
<build>
<plugins>
<plugin>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>maven-wadl-plugin</artifactId>
<version>1.19.4</version>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
<version>2.25.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>2.8.10</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-multipart</artifactId>
<version>2.25.1</version>
</dependency>
<dependency>
<groupId>com.mycompany.bpds</groupId>
<artifactId>bpds-common</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>generate</id>
<goals>
<goal>generate</goal>
</goals>
<phase>package</phase>
<configuration>
<wadlFile>${project.build.directory}/endpoints.wadl</wadlFile>
<formatWadlFile>true</formatWadlFile>
<baseUri>http://localhost:9021/</baseUri>
<packagesResourceConfig>
<param>com.mycompany.rest</param>
</packagesResourceConfig>
<wadlGenerators>
<!-- Doesn't work wit current version of Xerces.
<wadlGeneratorDescription>
<className>com.sun.jersey.server.wadl.generators.WadlGeneratorApplicationDoc</className>
<properties>
<property>
<name>applicationDocsFile</name>
<value>${project.build.directory}/app-wadl-doc.xml</value>
</property>
</properties>
</wadlGeneratorDescription>
<wadlGeneratorDescription>
<className>com.sun.jersey.server.wadl.generators.WadlGeneratorGrammarsSupport</className>
<properties>
<property>
<name>grammarsFile</name>
<value>${project.build.directory}/app-wadl-grammar.xml</value>
</property>
</properties>
</wadlGeneratorDescription>
-->
</wadlGenerators>
</configuration>
</execution>
</executions>
</plugin>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.