raml-for-jax-rs
raml-for-jax-rs copied to clipboard
jaxrs-to-raml maven error IllegalArgumentException
Hi there,
I'm using jaxrs-to-raml maven plugin to try to generate RAML file, however I'm getting the following error message after doing: mvn clean install
ERROR] Failed to execute goal org.raml.jaxrs:jaxrs-to-raml-maven-plugin:3.0.4:jaxrstoraml (default) on project demo-jar: Execution default of goal org.raml.jaxrs:jaxrs-to-raml-maven-plugin:3.0.4:jaxrstoraml failed.: IllegalArgumentException -> [Help 1]
Here extract of my pom parent and the dependent pom is attached as txt file:
<!-- RAML -->
<dependency>
<groupId>org.raml.jaxrs</groupId>
<artifactId>raml-generator-api</artifactId>
<version>3.0.4</version>
</dependency>
<dependency>
<groupId>org.raml.jaxrs</groupId>
<artifactId>raml-emitter</artifactId>
<version>3.0.4</version>
</dependency>
<dependency>
<groupId>org.raml.jaxrs</groupId>
<artifactId>jaxrs-test-resources</artifactId>
<version>3.0.4</version>
</dependency>
Thanks for your help in advance !
Could you show me the output of mvn -X clean install. I don't have much in the ways of stack traces.
Hmmmmmmmm.
the code is failing here:
if (readShort(off + 6) > Opcodes.V9) {
throw new IllegalArgumentException();
}
Smells like the code that I'm trying to parse (or that jersey is trying to parse) is greater than Java 9.
Is there any way you could compile it with a target that is java 9 ? Just to check if that would work ?
Hi,
I'm using Open JDK 11, I changed to JDK 8 and it looks better, however I'm getting now a warning who stops from creating the RAML.
Here extract of message:
--- jaxrs-to-raml-maven-plugin:3.0.4:jaxrstoraml (default) @ demo-jar --- [INFO] Configuration [INFO] input: D:\svn\demo\demo-jar\target\classes [INFO] source directory: D:\svn\demo\demo-jar\src [INFO] output directory: D:\svn\demo\demo-jar\target\generated-sources\raml-jaxrs [INFO] output file name: demo-jar.raml [INFO] parsing JaxRs resource: D:\svn\demo\demo-jar\target\classes
[WARNING] could not find source file D:\svn\demo\demo-jar\src\ca\demo\service\rest\AmazonS3Service.java for method public javax.ws.rs.core.Response ca.demo.service.rest.AmazonS3Service.getListFileForUrl(javax.servlet.http.HttpServletResponse,java.lang.String,java.lang.Boolean,java.lang.Boolean)
[WARNING] could not find source file D:\svn\demo\demo-jar\src\ca\demo\service\rest\ProjectService.java for method public javax.ws.rs.core.Response ca.demo.rest.ProjectService.getProjectLang(java.lang.String,java.lang.String)
[WARNING] could not find source file D:\svn\demo\demo-jar\src\ca\demo\service\rest\ProjectService.java for method public javax.ws.rs.core.Response ca.demo.service.rest.ProjectService.getProject(java.lang.String)
I think the problem is seeting the source folder with jaxrstoraml plug-in
I have this parameter:
<sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
which value is: D:\svn\demo\demo-jar\src
My sources are in:
D:\svn\demo\demo-jar\demo-core-src\ca\demo\service\rest
Extract of my pom related to setting sources:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>demo-core-src</source>
</sources>
</configuration>
</execution>
<build>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
<exclude>**/*.bat</exclude>
</excludes>
</resource>
<resource>
<directory>demo-core-src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
</build>
Do you know how could I fix this by setting the right parameters in <sourceDirectory> in jaxrs-to-raml-maven-plugin ?
Thanks,
Missed your reply. Do you have the code available somewhere ? Your configuration should work...
Hi,
Thanks for your answer, I don't have the sources available. However I have uploaded the output logs. I realized my RAML file was generated which is great ! and it looks good, however I have these warning (in the log file) that I'm not sure this is bad.
Thanks, output-stack-trace.txt
Ok, i've checked the code. I need the actual source code for only one real reason: reading comments in the source code, that I then try to stuff in raml documentation fields. So it should do the rest correctly.
I still need to figure out what's going on, whether it's me or the jaxrs libraries.
@jpbelang is the plugin still incapable of any JDK > 9? That seems so long ago .... ;)
I have the same problem/error with JDK 11, I have updated some dependencies and now it works, but ...
The configuration:
<plugin>
<groupId>org.raml.jaxrs</groupId>
<artifactId>jaxrs-to-raml-maven-plugin</artifactId>
<version>3.0.7</version>
<configuration>
<input>${project.build.outputDirectory}</input>
<topPackage>...</topPackage>
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
<outputFileName>${project.artifactId}-${project.version}.raml</outputFileName>
</configuration>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
<version>2.27</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.bundles.repackaged</groupId>
<artifactId>jersey-guava</artifactId>
<version>2.26-b03</version>
</dependency>
</dependencies>
</plugin>
Is this project abandoned?
Thx