This maven plugin is a wrapper around the rdl binary tool. Projects may use this plugin to generate java source files from rdl files defined within the project. RDL is a formal language for defining restful resources.
The :generate-jax-rs-resources
goal generates jax-rs resources from a project's rdl files.
mvn rdl:generate-jax-rs-resources
It is simply a wrapper around rdl generate java-model
and rdl generate java-server
.
<project>
<dependencies>
<dependency>
<groupId>com.yahoo.rdl</groupId>
<artifactId>rdl-java</artifactId>
<version>1.4.8</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.yahoo.rdl</groupId>
<artifactId>rdl-maven-plugin</artifactId>
<version>1.14.5</version>
<configuration>
<rdlDirectory>${project.build.resources[0].directory}/rdl</rdlDirectory>
<generatedClientDirectory>${project.build.directory}/generated-sources/rdl</generatedClientDirectory>
<sourceEncoding>UTF-8</sourceEncoding>
</configuration>
<executions>
<execution>
<id>generate-jax-rs-resources</id>
<phase>generate-sources</phase>
<goals>
<goal>generate-jax-rs-resources</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>bintray-yahoo-maven</id>
<name>bintray-plugins</name>
<url>http://yahoo.bintray.com/maven</url>
</pluginRepository>
</pluginRepositories>
</project>
Code generated by the :generate-jax-rs-resources
goal will depend on rdl-java
and some server classes.
<project>
<dependencies>
<dependency>
<groupId>com.yahoo.rdl</groupId>
<artifactId>rdl-java</artifactId>
<version>1.4.8</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>9.2.2.v20140723</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<version>2.22.1</version>
</dependency>
</dependencies>
</project>
See the integration test for a more complete example.
Specifies the folder where the *.rdl
files are in the project source tree. Default value is src/main/resources/rdl
.
Defaults to project.build.sourceEncoding
, or UTF-8 if project.build.sourceEncoding
is not defined. Should be set
to the character encoding of the rdl files.
Defaults to false. If set to true, then this plugin will do nothing. Useful in the context of a multi-module maven project, when you want to override the inheritance of rdl-maven-plugin.
mvn clean install
Integration tests are handled by the maven-invoker-plugin
. They can be run with
mvn -P run-its clean install
To debug the plugin while it is running in an integration test, assign debugging flags to invoker.mavenOpts
.
For instance,
mvn -P run-its clean install -Dinvoker.mavenOpts="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"
Copyright 2016 Yahoo Inc.
Licensed under the terms of the Apache version 2.0 license. See LICENSE file for terms.