Valay
Valay

Reputation: 1999

JAX-RS to RAML example not working

Here is the scenario. I am new to RAML. We've REST services already written with jax-rs. Now we want to integrate RAML to generate documentation of these API.

I've already installed RAML JAX-RS plugin into eclipse with help from RAML for JAX-RS

And also downloaded the repository from RAML fo JAX-RS on GITHUB

Examples are given for jax-rs to RAML here

I've gone through documentation but still struggling to start with actual implementation.

I want to know how do I run these examples from eclipse and how to generate RAML from already written REST API with jax-rs ?

Update:

I've imported examples as existing maven project. And tried to generate RAML from HelloWorldRest.java in examples folder. And getting below error. Please find attache screenshot as well.

java.lang.IllegalStateException: Java Model Exception: Java Model Status [RAML_POC does not exist]

enter image description here

More update

I performed below steps to import: Import in Package Explorer -> Maven -> Existing Maven Projects -> Selected root directory of repository -> Seleted availabe 3 projects: com.mulesoft.jaxrs.raml.generator, com.mulesoft.jaxrs.raml.generator.annotations and jaxrs-raml-maven-plugin.

Then open HelloWorldRest.java, right-click and select Generate RAML from classes. And get the error mentioned.

The git repository struncture is also available in attached screenshot.

Upvotes: 1

Views: 2395

Answers (1)

kucing_terbang
kucing_terbang

Reputation: 5131

Seems like the error is caused by the fact that you actually haven't set the project as a "Java Project". Thus, the source code you selected (in this case HelloWorldRest.java) has not been parsed as a "Source Code".

You could try :

  • Import the example project (the helloworld project) directly as a maven project rather than jaxrs-raml-maven-plugin project. or,

  • Set the folder src/main/java/helloworld/ as a source folder. This can be done by :

    1. First convert the project into faceted form.
    2. Make sure that the examples/helloworld/src/main/java is set as a source folder

After you try either one of these steps. Try to generate the RAML again from the class.

Upvotes: 1

Related Questions