In addition to the maven plugin, RAML for the JAX-RS project has a CLI tool for generating the JAX-RS resource classes from RAML. Its usage is as follows:
- Clone the https://github.com/mulesoft-labs/raml-for-jax-rs project and build it locally.
- To generate the JAX-RS code, run the ramltojaxs command with the following arguments:
ramltojaxrs -d <arg> [-g <arg>] [-m <arg>] [-r <arg>] [-s <arg>]
-d,--directory <arg> generation directory
-g,--generate-types-with <arg> generate types with plugins (jackson,
gson, jaxb, javadoc, jsr303)
-m,--model-package <arg> model package
-r,--resource-package <arg> resource package
-s,--support-package <arg> support package
From the jaxrs-to-raml-cli project folder, execute the ramltojaxrs program to generate the JAX-RS resources from the department-resource.raml file, as shown ahead:
java -jar ./target/raml-to-jaxrs-cli-2.1.0-jar-with-dependencies.jar -d /tmp -r com.packtpub.rest.ch7.service -m com.packtpub.rest.ch7.model -g jsr303 ../../../rest-chapter7-service-doctools/rest-chapter7-raml2jaxrs/src/main/resources/raml/department-resource.raml