Open silvafabio opened 6 years ago
The Class type is not natively supported by RAML: it can't translate the type simply.
You have to define a plugin to allow you to change the type to something else. There is an example of this here: https://github.com/mulesoft-labs/raml-for-jax-rs/blob/release/3.0.2/jaxrs-to-raml/jaxrs-test-resources/src/main/java/org/raml/jaxrs/examples/resources/package-info.java
And there is some docs here: https://github.com/mulesoft-labs/raml-for-jax-rs/blob/master/jaxrs-to-raml/raml-generator-api/README.md
I don't use Class or Generic type in any piece of code, it's strange!
Ok, well that kills that theory. Do you have a code sample?
I think I know what's up. When parsing java types, the system needs to know how to parse java types. If you don't do that it falls back to parsing it as a bean. This almost never makes sense, however if you already have annotations and such in the classes (for either jaxb or jackson...).
I think the default strategy picks up getClass() (I'll fix that).
You could look at these examples: https://github.com/mulesoft-labs/raml-for-jax-rs/blob/master/jaxrs-to-raml/jaxrs-to-raml-examples/jaxrs-to-raml-maven-examples/jaxrs-to-raml-raml-examples/src/main/java/org/raml/jaxrs/examples/ramlexamples/ProducedJsonValue.java
Some docs are here: https://github.com/mulesoft-labs/raml-for-jax-rs/blob/master/jaxrs-to-raml/raml-generator-api/README.md
Hi.
Sorry for the late, attached is a little isolated sample ;-)
That's true i didn't put any a annotations :-(
Thanks
Hi.
I think this issue could be related to #216
My environment:
This is my first try:
When i run "mvn clean package" i get:
[INFO] --- jaxrs-to-raml-maven-plugin:3.0.1:jaxrstoraml (default) @ VTIApi --- [INFO] Configuration [INFO] input: /home/fabio/Documents/desenvolvimento/projetos/vti-api/target/classes [INFO] source directory: /home/fabio/Documents/desenvolvimento/projetos/vti-api/src/main/java [INFO] output directory: /home/fabio/Documents/desenvolvimento/projetos/vti-api/target/generated-sources/raml-jaxrs [INFO] output file name: VTIApi.raml [INFO] parsing JaxRs resource: /home/fabio/Documents/desenvolvimento/projetos/vti-api/target/classes [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 11.386 s [INFO] Finished at: 2018-05-03T20:15:35-03:00 [INFO] Final Memory: 29M/195M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.raml.jaxrs:jaxrs-to-raml-maven-plugin:3.0.1:jaxrstoraml (default) on project VTIApi: Execution default of goal org.raml.jaxrs:jaxrs-to-raml-maven-plugin:3.0.1:jaxrstoraml failed: A required class was missing while executing org.raml.jaxrs:jaxrs-to-raml-maven-plugin:3.0.1:jaxrstoraml: br/com/vanguardati/bluesystemcore/usecase/ClienteInativoException [ERROR] ----------------------------------------------------- [ERROR] realm = plugin>org.raml.jaxrs:jaxrs-to-raml-maven-plugin:3.0.1 [ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy [ERROR] urls[0] = file:/home/fabio/.m2/repository/org/raml/jaxrs/jaxrs-to-raml-maven-plugin/3.0.1/jaxrs-to-raml-maven-plugin-3.0.1.jar [ERROR] urls[1] = file:/home/fabio/.m2/repository/org/apache/commons/commons-lang3/3.4/commons-lang3-3.4.jar [ERROR] urls[2] = file:/home/fabio/.m2/repository/javax/enterprise/cdi-api/1.0/cdi-api-1.0.jar [ERROR] urls[3] = file:/home/fabio/.m2/repository/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar [ERROR] urls[4] = file:/home/fabio/.m2/repository/org/eclipse/sisu/org.eclipse.sisu.inject/0.3.2/org.eclipse.sisu.inject-0.3.2.jar [ERROR] urls[5] = file:/home/fabio/.m2/repository/org/apache/maven/plugin-tools/maven-plugin-annotations/3.5/maven-plugin-annotations-3.5.jar [ERROR] urls[6] = file:/home/fabio/.m2/repository/org/apache/maven/plugin-tools/maven-plugin-tools-api/3.5/maven-plugin-tools-api-3.5.jar [ERROR] urls[7] = file:/home/fabio/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar [ERROR] urls[8] = file:/home/fabio/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.11/plexus-interpolation-1.11.jar [ERROR] urls[9] = file:/home/fabio/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.20/plexus-utils-3.0.20.jar [ERROR] urls[10] = file:/home/fabio/.m2/repository/org/apache/maven/plugin-tools/maven-plugin-tools-annotations/3.5/maven-plugin-tools-annotations-3.5.jar [ERROR] urls[11] = file:/home/fabio/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar [ERROR] urls[12] = file:/home/fabio/.m2/repository/org/ow2/asm/asm/5.0.2/asm-5.0.2.jar [ERROR] urls[13] = file:/home/fabio/.m2/repository/org/codehaus/plexus/plexus-archiver/2.1.1/plexus-archiver-2.1.1.jar [ERROR] urls[14] = file:/home/fabio/.m2/repository/org/codehaus/plexus/plexus-io/2.0.3/plexus-io-2.0.3.jar [ERROR] urls[15] = file:/home/fabio/.m2/repository/com/thoughtworks/qdox/qdox/2.0-M4/qdox-2.0-M4.jar [ERROR] urls[16] = file:/home/fabio/.m2/repository/com/google/guava/guava/19.0/guava-19.0.jar [ERROR] urls[17] = file:/home/fabio/.m2/repository/org/raml/jaxrs/utilities/3.0.1/utilities-3.0.1.jar [ERROR] urls[18] = file:/home/fabio/.m2/repository/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar [ERROR] urls[19] = file:/home/fabio/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar [ERROR] urls[20] = file:/home/fabio/.m2/repository/org/raml/jaxrs/jaxrs-to-raml-core/3.0.1/jaxrs-to-raml-core-3.0.1.jar [ERROR] urls[21] = file:/home/fabio/.m2/repository/org/raml/jaxrs/jaxrs-parser/3.0.1/jaxrs-parser-3.0.1.jar [ERROR] urls[22] = file:/home/fabio/.m2/repository/org/reflections/reflections/0.9.10/reflections-0.9.10.jar [ERROR] urls[23] = file:/home/fabio/.m2/repository/org/javassist/javassist/3.19.0-GA/javassist-3.19.0-GA.jar [ERROR] urls[24] = file:/home/fabio/.m2/repository/com/google/code/findbugs/annotations/2.0.1/annotations-2.0.1.jar [ERROR] urls[25] = file:/home/fabio/.m2/repository/javax/ws/rs/javax.ws.rs-api/2.0.1/javax.ws.rs-api-2.0.1.jar [ERROR] urls[26] = file:/home/fabio/.m2/repository/org/raml/jaxrs/jaxrs-api/3.0.1/jaxrs-api-3.0.1.jar [ERROR] urls[27] = file:/home/fabio/.m2/repository/org/glassfish/jersey/core/jersey-server/2.24/jersey-server-2.24.jar [ERROR] urls[28] = file:/home/fabio/.m2/repository/org/glassfish/jersey/core/jersey-common/2.24/jersey-common-2.24.jar [ERROR] urls[29] = file:/home/fabio/.m2/repository/org/glassfish/jersey/bundles/repackaged/jersey-guava/2.24/jersey-guava-2.24.jar [ERROR] urls[30] = file:/home/fabio/.m2/repository/org/glassfish/hk2/osgi-resource-locator/1.0.1/osgi-resource-locator-1.0.1.jar [ERROR] urls[31] = file:/home/fabio/.m2/repository/org/glassfish/jersey/core/jersey-client/2.24/jersey-client-2.24.jar [ERROR] urls[32] = file:/home/fabio/.m2/repository/org/glassfish/jersey/media/jersey-media-jaxb/2.24/jersey-media-jaxb-2.24.jar [ERROR] urls[33] = file:/home/fabio/.m2/repository/javax/annotation/javax.annotation-api/1.2/javax.annotation-api-1.2.jar [ERROR] urls[34] = file:/home/fabio/.m2/repository/org/glassfish/hk2/hk2-api/2.5.0-b05/hk2-api-2.5.0-b05.jar [ERROR] urls[35] = file:/home/fabio/.m2/repository/org/glassfish/hk2/hk2-utils/2.5.0-b05/hk2-utils-2.5.0-b05.jar [ERROR] urls[36] = file:/home/fabio/.m2/repository/org/glassfish/hk2/external/aopalliance-repackaged/2.5.0-b05/aopalliance-repackaged-2.5.0-b05.jar [ERROR] urls[37] = file:/home/fabio/.m2/repository/org/glassfish/hk2/external/javax.inject/2.5.0-b05/javax.inject-2.5.0-b05.jar [ERROR] urls[38] = file:/home/fabio/.m2/repository/org/glassfish/hk2/hk2-locator/2.5.0-b05/hk2-locator-2.5.0-b05.jar [ERROR] urls[39] = file:/home/fabio/.m2/repository/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar [ERROR] urls[40] = file:/home/fabio/.m2/repository/org/glassfish/jersey/media/jersey-media-multipart/2.24/jersey-media-multipart-2.24.jar [ERROR] urls[41] = file:/home/fabio/.m2/repository/org/jvnet/mimepull/mimepull/1.9.6/mimepull-1.9.6.jar [ERROR] urls[42] = file:/home/fabio/.m2/repository/org/jboss/forge/roaster/roaster-api/2.19.4.Final/roaster-api-2.19.4.Final.jar [ERROR] urls[43] = file:/home/fabio/.m2/repository/org/jboss/forge/roaster/roaster-jdt/2.19.4.Final/roaster-jdt-2.19.4.Final.jar [ERROR] urls[44] = file:/home/fabio/.m2/repository/org/mockito/mockito-core/2.2.28/mockito-core-2.2.28.jar [ERROR] urls[45] = file:/home/fabio/.m2/repository/net/bytebuddy/byte-buddy/1.5.5/byte-buddy-1.5.5.jar [ERROR] urls[46] = file:/home/fabio/.m2/repository/net/bytebuddy/byte-buddy-agent/1.5.5/byte-buddy-agent-1.5.5.jar [ERROR] urls[47] = file:/home/fabio/.m2/repository/org/objenesis/objenesis/2.4/objenesis-2.4.jar [ERROR] urls[48] = file:/home/fabio/.m2/repository/org/raml/jaxrs/jaxrs-to-raml-converter/3.0.1/jaxrs-to-raml-converter-3.0.1.jar [ERROR] urls[49] = file:/home/fabio/.m2/repository/org/raml/jaxrs/raml-api/3.0.1/raml-api-3.0.1.jar [ERROR] urls[50] = file:/home/fabio/.m2/repository/org/raml/jaxrs/raml-emitter/3.0.1/raml-emitter-3.0.1.jar [ERROR] urls[51] = file:/home/fabio/.m2/repository/org/raml/jaxrs/raml-generator-api/3.0.1/raml-generator-api-3.0.1.jar [ERROR] urls[52] = file:/home/fabio/.m2/repository/org/raml/raml-to-pojo/1.0.1/raml-to-pojo-1.0.1.jar [ERROR] urls[53] = file:/home/fabio/.m2/repository/org/hamcrest/hamcrest-all/1.3/hamcrest-all-1.3.jar [ERROR] urls[54] = file:/home/fabio/.m2/repository/com/squareup/javapoet/1.7.0/javapoet-1.7.0.jar [ERROR] urls[55] = file:/home/fabio/.m2/repository/com/google/code/gson/gson/2.5/gson-2.5.jar [ERROR] urls[56] = file:/home/fabio/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.1/jackson-mapper-asl-1.9.1.jar [ERROR] urls[57] = file:/home/fabio/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.9.1/jackson-core-asl-1.9.1.jar [ERROR] urls[58] = file:/home/fabio/.m2/repository/com/fasterxml/jackson/module/jackson-module-jsonSchema/2.8.3/jackson-module-jsonSchema-2.8.3.jar [ERROR] urls[59] = file:/home/fabio/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.8.0/jackson-annotations-2.8.0.jar [ERROR] urls[60] = file:/home/fabio/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.8.3/jackson-core-2.8.3.jar [ERROR] urls[61] = file:/home/fabio/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.8.3/jackson-databind-2.8.3.jar [ERROR] urls[62] = file:/home/fabio/.m2/repository/org/raml/raml-simple-emitter/1.0.1/raml-simple-emitter-1.0.1.jar [ERROR] urls[63] = file:/home/fabio/.m2/repository/org/raml/raml-parser-tools/1.0.1/raml-parser-tools-1.0.1.jar [ERROR] urls[64] = file:/home/fabio/.m2/repository/org/raml/raml-parser-2/1.0.9/raml-parser-2-1.0.9.jar [ERROR] urls[65] = file:/home/fabio/.m2/repository/org/raml/yagi/1.0.9/yagi-1.0.9.jar [ERROR] urls[66] = file:/home/fabio/.m2/repository/org/yaml/snakeyaml/1.15/snakeyaml-1.15.jar [ERROR] urls[67] = file:/home/fabio/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar [ERROR] urls[68] = file:/home/fabio/.m2/repository/joda-time/joda-time/2.3/joda-time-2.3.jar [ERROR] urls[69] = file:/home/fabio/.m2/repository/com/github/fge/json-schema-validator/2.2.6/json-schema-validator-2.2.6.jar [ERROR] urls[70] = file:/home/fabio/.m2/repository/com/google/code/findbugs/jsr305/3.0.0/jsr305-3.0.0.jar [ERROR] urls[71] = file:/home/fabio/.m2/repository/com/googlecode/libphonenumber/libphonenumber/6.2/libphonenumber-6.2.jar [ERROR] urls[72] = file:/home/fabio/.m2/repository/com/github/fge/json-schema-core/1.2.5/json-schema-core-1.2.5.jar [ERROR] urls[73] = file:/home/fabio/.m2/repository/com/github/fge/uri-template/0.9/uri-template-0.9.jar [ERROR] urls[74] = file:/home/fabio/.m2/repository/com/github/fge/msg-simple/1.1/msg-simple-1.1.jar [ERROR] urls[75] = file:/home/fabio/.m2/repository/com/github/fge/btf/1.2/btf-1.2.jar [ERROR] urls[76] = file:/home/fabio/.m2/repository/com/github/fge/jackson-coreutils/1.8/jackson-coreutils-1.8.jar [ERROR] urls[77] = file:/home/fabio/.m2/repository/org/mozilla/rhino/1.7R4/rhino-1.7R4.jar [ERROR] urls[78] = file:/home/fabio/.m2/repository/javax/mail/mailapi/1.4.3/mailapi-1.4.3.jar [ERROR] urls[79] = file:/home/fabio/.m2/repository/javax/activation/activation/1.1/activation-1.1.jar [ERROR] urls[80] = file:/home/fabio/.m2/repository/net/sf/jopt-simple/jopt-simple/4.6/jopt-simple-4.6.jar [ERROR] urls[81] = file:/home/fabio/.m2/repository/com/googlecode/juniversalchardet/juniversalchardet/1.0.3/juniversalchardet-1.0.3.jar [ERROR] urls[82] = file:/home/fabio/.m2/repository/org/apache/ws/xmlschema/xmlschema-core/2.2.1/xmlschema-core-2.2.1.jar [ERROR] urls[83] = file:/home/fabio/.m2/repository/org/raml/raml-builder/1.0.1/raml-builder-1.0.1.jar [ERROR] urls[84] = file:/home/fabio/.m2/repository/org/raml/pojo-to-raml/1.0.1/pojo-to-raml-1.0.1.jar [ERROR] urls[85] = file:/home/fabio/.m2/repository/org/raml/test-utils/1.0.1/test-utils-1.0.1.jar [ERROR] urls[86] = file:/home/fabio/.m2/repository/commons-io/commons-io/2.5/commons-io-2.5.jar [ERROR] Number of foreign imports: 1 [ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]] [ERROR] [ERROR] ----------------------------------------------------- [ERROR] : br.com.vanguardati.bluesystemcore.usecase.ClienteInativoException [ERROR] -> [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/PluginContainerException
Ok, it's happen three times with diferente classes and i solve by changing my pom.xml to:
And then when i run "mvn -e clean pakage":
[INFO] --- jaxrs-to-raml-maven-plugin:3.0.1:jaxrstoraml (default) @ VTIApi --- [INFO] Configuration [INFO] input: /home/fabio/Documents/desenvolvimento/projetos/vti-api/target/classes [INFO] source directory: /home/fabio/Documents/desenvolvimento/projetos/vti-api/src/main/java [INFO] output directory: /home/fabio/Documents/desenvolvimento/projetos/vti-api/target/generated-sources/raml-jaxrs [INFO] output file name: VTIApi.raml [INFO] parsing JaxRs resource: /home/fabio/Documents/desenvolvimento/projetos/vti-api/target/classes [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 12.788 s [INFO] Finished at: 2018-05-03T20:22:03-03:00 [INFO] Final Memory: 31M/288M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.raml.jaxrs:jaxrs-to-raml-maven-plugin:3.0.1:jaxrstoraml (default) on project VTIApi: Execution default of goal org.raml.jaxrs:jaxrs-to-raml-maven-plugin:3.0.1:jaxrstoraml failed: cannot parse property of type java.lang.Class<?> -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.raml.jaxrs:jaxrs-to-raml-maven-plugin:3.0.1:jaxrstoraml (default) on project VTIApi: Execution default of goal org.raml.jaxrs:jaxrs-to-raml-maven-plugin:3.0.1:jaxrstoraml failed: cannot parse property of type java.lang.Class<?> at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345) at org.apache.maven.cli.MavenCli.main(MavenCli.java:191) 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.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default of goal org.raml.jaxrs:jaxrs-to-raml-maven-plugin:3.0.1:jaxrstoraml failed: cannot parse property of type java.lang.Class<?> at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) ... 20 more Caused by: java.lang.IllegalArgumentException: cannot parse property of type java.lang.Class<?> at org.raml.pojotoraml.types.RamlTypeFactory.forType(RamlTypeFactory.java:79) at org.raml.pojotoraml.PojoToRamlImpl.exploreType(PojoToRamlImpl.java:161) at org.raml.pojotoraml.PojoToRamlImpl.handleSingleType(PojoToRamlImpl.java:88) at org.raml.pojotoraml.PojoToRamlImpl.handleSingleType(PojoToRamlImpl.java:98) at org.raml.pojotoraml.PojoToRamlImpl.handleSingleType(PojoToRamlImpl.java:98) at org.raml.pojotoraml.PojoToRamlImpl.handleSingleType(PojoToRamlImpl.java:98) at org.raml.pojotoraml.PojoToRamlImpl.handleSingleType(PojoToRamlImpl.java:98) at org.raml.pojotoraml.PojoToRamlImpl.classToRaml(PojoToRamlImpl.java:40) at org.raml.jaxrs.types.RamlType.write(RamlType.java:144) at org.raml.jaxrs.types.TypeRegistry.writeAll(TypeRegistry.java:64) at org.raml.emitter.ModelEmitter.emit(ModelEmitter.java:87) at org.raml.emitter.FileEmitter.emit(FileEmitter.java:56) at org.raml.jaxrs.raml.core.OneStopShop.parseJaxRsAndOutputRaml(OneStopShop.java:82) at org.raml.jaxrs.plugin.JaxRsToRamlMojo.confinedExecute(JaxRsToRamlMojo.java:123) at org.raml.jaxrs.plugin.JaxRsToRamlMojo.execute(JaxRsToRamlMojo.java:80) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) ... 21 more [ERROR] [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/PluginExecutionException