Discuss.FOLIO.org is no longer used. This is a static snapshot of the website as of February 14, 2023.

How to create *.raml and *.schema in RMB?

folios
24 Feb '17

Is it right that I need to create *.raml and *.schema manually first of all?

julianladisch
24 Feb '17

Yes, for a new module these files are needed because maven needs them to generate java interfaces and java objects. An example is in the documentation: https://github.com/folio-org/raml-module-builder#step-1-describe-the-apis-to-be-exposed-by-the-new-module

folios
16 Mar '17

I have created a new module which parent is raml-module-builder , and I carry on according to your steps, but I have error in step 3 , and my pom.xml and the console log are as following when I run mvn install:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.folio</groupId>
    <artifactId>raml-module-builder</artifactId>
    <version>8.0.0-SNAPSHOT</version>
  </parent>
  <artifactId>calis-raml-test</artifactId>
   <properties>
    <ramlfiles_path>${basedir}/ramls</ramlfiles_path>
    <ramlfiles_util_path>${basedir}/raml-util</ramlfiles_util_path>
  </properties>
  <dependencies>
  	<dependency>
  		<groupId>org.folio</groupId>
		<artifactId>domain-models-runtime</artifactId>
		<version>8.0.0-SNAPSHOT</version>	
  	</dependency>
  </dependencies>
  
  
  
 	<build>
	    <plugins>
	  <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
          <encoding>UTF-8</encoding>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.5.0</version>
        
        <executions>
          <execution>
            <id>generate_interfaces</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>java</goal>
            </goals>
            <configuration>
              <mainClass>org.folio.rest.tools.GenerateRunner</mainClass>
              <!-- <executable>java</executable> -->
              <cleanupDaemonThreads>false</cleanupDaemonThreads>
              <systemProperties>
                <systemProperty>
                  <key>project.basedir</key>
                  <value>${basedir}</value>
                </systemProperty>
                <systemProperty>
                  <key>raml_files</key>
                  <value>${ramlfiles_path}/circulation</value>
                </systemProperty>
              </systemProperties>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>aspectj-maven-plugin</artifactId>
        <version>1.8</version>
        <configuration>
          <verbose>true</verbose>
          <showWeaveInfo>false</showWeaveInfo>
          <complianceLevel>1.8</complianceLevel>
          <includes>
            <include>**/impl/*.java</include>
            <include>**/*.aj</include>
          </includes>
          <aspectDirectory>src/main/java/org/folio/rest/annotations</aspectDirectory>
          <XaddSerialVersionUID>true</XaddSerialVersionUID>
          <showWeaveInfo>true</showWeaveInfo>
          <aspectLibraries>
            <aspectLibrary>
              <groupId>org.folio</groupId>
              <artifactId>domain-models-api-aspects</artifactId>
            </aspectLibrary>
          </aspectLibraries>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
            </goals>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>1.8.9</version>
          </dependency>
          <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjtools</artifactId>
            <version>1.8.9</version>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>3.0.1</version>
        <executions>
          <execution>
            <id>copy-resources</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${basedir}/target/classes/apidocs/raml</outputDirectory>
              <resources>
                <resource>
                  <directory>${ramlfiles_path}</directory>
                  <filtering>true</filtering>
                </resource>
              </resources>
            </configuration>
          </execution>
          <execution>
            <id>copy-resources-2</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${basedir}/target/classes/apidocs/raml-util</outputDirectory>
              <resources>
                <resource>
                  <directory>${ramlfiles_util_path}</directory>
                  <filtering>true</filtering>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>2.3</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <transformers>
                <transformer
                  implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                  <manifestEntries>
                    <Main-Class>org.folio.rest.RestLauncher</Main-Class>
                    <Main-Verticle>org.folio.rest.RestVerticle</Main-Verticle>
                  </manifestEntries>
                </transformer>
              </transformers>
              <artifactSet />
              <outputFile>${project.build.directory}/${project.artifactId}-fat.jar</outputFile>
            </configuration>
          </execution>
        </executions>
      </plugin>
	    </plugins>
    </build>
   
</project>

[WARNING] 
[WARNING] Some problems were encountered while building the effective settings
[WARNING] expected START_TAG or END_TAG not TEXT (position: TEXT seen ...<id>nexus</id>\n\t\t\t\tall requests to nexus via the mirror\n\t\t\t\t<r... @136:7)  @ D:\develop\apache-maven-3.3.9-bin\apache-maven-3.3.9\conf\settings.xml, line 136, column 7
[WARNING] expected START_TAG or END_TAG not TEXT (position: TEXT seen ...<id>nexus</id>\n\t\t\t\tall requests to nexus via the mirror\n\t\t\t\t<r... @136:7)  @ D:\develop\apache-maven-3.3.9-bin\apache-maven-3.3.9\conf\settings.xml, line 136, column 7
[WARNING] 
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building calis-raml-test 8.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-java) @ calis-raml-test ---
[INFO] 
[INFO] --- properties-maven-plugin:1.0.0:set-system-properties (default) @ calis-raml-test ---
[INFO] Set 1 system property
[INFO] 
[INFO] --- exec-maven-plugin:1.5.0:exec (git submodule update) @ calis-raml-test ---
[INFO] 
[INFO] --- exec-maven-plugin:1.5.0:java (generate_interfaces) @ calis-raml-test ---
Input directory F:\Users\user\AppData\Local\WorkSpace-Git\raml-module-builder\calis-raml-test/ramls/circulation
F:\Users\user\AppData\Local\WorkSpace-Git\raml-module-builder\calis-raml-test/ramls/circulation is not a valid directory
[WARNING] 
java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:294)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
	at org.folio.rest.tools.GenerateRunner.main(GenerateRunner.java:90)
	... 6 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.964 s
[INFO] Finished at: 2017-03-16T11:00:24+08:00
[INFO] Final Memory: 20M/307M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.5.0:java (generate_interfaces) on project calis-raml-test: An exception occured while executing the Java class. null: InvocationTargetException: NullPointerException -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
folios
16 Mar '17

I put the ebook.raml and ebook.schema in the root directory src/main/resources of the new module .

folios
16 Mar '17

I can get target/domain-models-runtimes-fat.jar in module of domain-models-runtime after run mvn install on raml-models-builder , then I got directory of domain-models-runtime-fat after decompressing domain-models-runtimes-fat.jar as following capture .
As we can see there are lots of sub directories under the directory of domain-models-runtime-fat , it sames that the html of http://localhost:8081/apidocs/ come from directory of apidocs only , so what function of other directories ? Can you give an explanation ?

julianladisch
13 Jul '18

Instead of using raml-module-builder as parent module you start with module without parent as described on https://github.com/folio-org/raml-module-builder#get-started-with-a-sample-working-module .