mulesoft-labs / raml-for-jax-rs

This project is all about two way transformation of JAX-RS-annotated Java code to RAML API description and back.
Other
296 stars 181 forks source link

Customize the target(s) of the raml build from a maven project #404

Open fjoalland opened 5 years ago

fjoalland commented 5 years ago

Hi,

I need your help to customize the Raml files build of a maven project.

I currently have several RAML files within a single Maven project, I would like to be able to build all my RAML files from a single maven project (I am already able to do this), and I would like the generation of the different RAML files are divided into several subfolders.

Take the example below, it represents the project maven to be build.The directories are in bold character. My project Maven before being build:

The result below represents the project once it is build:

I do not know if it is possible to configure with this level of detail.

Here for the moment, my pom.xml of my project maven:

  <build>
    <plugins>
      <plugin>
        <groupId>org.raml.jaxrs</groupId>
        <artifactId>raml-to-jaxrs-maven-plugin</artifactId>
        <version>3.0.5</version>
        <executions>
          <execution>
            <goals>
              <goal>generate</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <ramlFile>apis-doc</ramlFile>
          <includes>
            <include>ramlA.raml</include>
          </includes>
          <resourcePackage>net.project.apis-lib.resources</resourcePackage>
          <supportPackage>net.project.apis-lib.support</supportPackage>
          <modelPackage>net.project.apis-lib.model</modelPackage>
          <generateTypesWith>
            <value>jackson2</value>
          </generateTypesWith>
        </configuration>
      </plugin>
    </plugins>
  </build>

I know it is already possible to builder several raml files at once with the property includes but I do not know if it is possible to customize the folder where we would like it to be build.

Thank you in advance.

jpbelang commented 5 years ago

Sorry about the delay, I've been handling a couple of other projects, and we're trying to port this project to the new parser.....time has bee waaaay too short.

The whole idea behind this project is to generate the java code for a raml file. So, the raml file needs to be a top level file. Once you've got that, then you'll get it to work.

However, there is only one "outputDirectory" parameter, and everything will be generated under one directory. To do what you want to do, you would need two execution of the raml-for-jaxrs plugin (one for each of your files) with each a different outputDirectory parameter.

I've never done this. If it fails, file an issue and I'll see if I can fix it quickly.