phoenixnap / springmvc-raml-plugin

Spring MVC - RAML Spec Synchroniser Plugin. A Maven plugin designed to Generate Server & Client code in Spring from a RAML API descriptor and conversely, a RAML API document from the SpringMVC Server implementation.
Apache License 2.0
136 stars 84 forks source link

URI is not absolute when using Maven Wrapper #237

Open tburny opened 6 years ago

tburny commented 6 years ago

I'm using Maven 3.5.2 / Maven Wrapper 0.4 with Maven 3.5.2 and plugin version 0.10.11.

When running the plugin with Maven (with mvn in the path), everything is fine and the build succeeds.

On the contrary when using Maven Wrapper (https://github.com/takari/maven-wrapper) with the very same command line (except for running the wrapper from the project root directory via ./mvnw, the build fails with a IllegalArgumentException.

It seems that an IllegalArgumentException is thrown in SchemaHelper:624 and following when using Maven wrapper, while with a standard maven no exception is thrown.


[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:42 min
[INFO] Finished at: 2018-03-02T18:51:44+01:00
[INFO] Final Memory: 17M/342M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.phoenixnap.oss:springmvc-raml-plugin:0.10.11:generate-springmvc-endpoints (generate-springmvc-endpoints) on project deichmann: Execution generate-springmvc-endpoints of goal com.phoenixnap.oss:springmvc-raml-plugin:0.10.11:generate-springmvc-endpoints failed: URI is not absolute -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.phoenixnap.oss:springmvc-raml-plugin:0.10.11:generate-springmvc-endpoints (generate-springmvc-endpoints) on project deichmann: Execution generate-springmvc-endpoints of goal com.phoenixnap.oss:springmvc-raml-plugin:0.10.11:generate-springmvc-endpoints failed: URI is not absolute
    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:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    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)
    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.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:39)
    at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:122)
    at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:55)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution generate-springmvc-endpoints of goal com.phoenixnap.oss:springmvc-raml-plugin:0.10.11:generate-springmvc-endpoints failed: URI is not absolute
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:145)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    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:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    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)
    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.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:39)
    at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:122)
    at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:55)
Caused by: java.lang.IllegalArgumentException: URI is not absolute
    at java.net.URI.toURL (URI.java:1088)
    at org.jsonschema2pojo.ContentResolver.resolve (ContentResolver.java:67)
    at org.jsonschema2pojo.SchemaStore.create (SchemaStore.java:48)
    at org.jsonschema2pojo.SchemaStore.create (SchemaStore.java:116)
    at org.jsonschema2pojo.rules.SchemaRule.apply (SchemaRule.java:59)
    at org.jsonschema2pojo.rules.SchemaRule.apply (SchemaRule.java:30)
    at org.jsonschema2pojo.rules.ArrayRule.apply (ArrayRule.java:81)
    at org.jsonschema2pojo.rules.ArrayRule.apply (ArrayRule.java:37)
    at org.jsonschema2pojo.rules.TypeRule.apply (TypeRule.java:113)
    at org.jsonschema2pojo.rules.TypeRule.apply (TypeRule.java:40)
    at org.jsonschema2pojo.rules.SchemaRule.apply (SchemaRule.java:73)
    at org.jsonschema2pojo.rules.SchemaRule.apply (SchemaRule.java:30)
    at org.jsonschema2pojo.rules.PropertyRule.apply (PropertyRule.java:75)
    at org.jsonschema2pojo.rules.PropertyRule.apply (PropertyRule.java:43)
    at org.jsonschema2pojo.rules.PropertiesRule.apply (PropertiesRule.java:70)
    at org.jsonschema2pojo.rules.PropertiesRule.apply (PropertiesRule.java:38)
    at org.jsonschema2pojo.rules.ObjectRule.apply (ObjectRule.java:115)
    at org.jsonschema2pojo.rules.ObjectRule.apply (ObjectRule.java:66)
    at org.jsonschema2pojo.rules.TypeRule.apply (TypeRule.java:90)
    at org.jsonschema2pojo.rules.TypeRule.apply (TypeRule.java:40)
    at org.jsonschema2pojo.rules.SchemaRule.apply (SchemaRule.java:73)
    at org.jsonschema2pojo.rules.SchemaRule.apply (SchemaRule.java:30)
    at org.jsonschema2pojo.SchemaMapper.generate (SchemaMapper.java:134)
    at com.phoenixnap.oss.ramlapisync.naming.SchemaHelper.buildBodyJCodeModel (SchemaHelper.java:639)
    at com.phoenixnap.oss.ramlapisync.naming.SchemaHelper.mapSchemaToPojo (SchemaHelper.java:561)
    at com.phoenixnap.oss.ramlapisync.data.ApiActionMetadata.parseResponse (ApiActionMetadata.java:216)
    at com.phoenixnap.oss.ramlapisync.data.ApiActionMetadata.<init> (ApiActionMetadata.java:78)
    at com.phoenixnap.oss.ramlapisync.data.ApiResourceMetadata.addApiCall (ApiResourceMetadata.java:64)
    at com.phoenixnap.oss.ramlapisync.generation.RamlParser.checkResource (RamlParser.java:219)
    at com.phoenixnap.oss.ramlapisync.generation.RamlParser.extractControllers (RamlParser.java:140)
    at com.phoenixnap.oss.ramlapisync.plugin.SpringMvcEndpointGeneratorMojo.generateEndpoints (SpringMvcEndpointGeneratorMojo.java:255)
    at com.phoenixnap.oss.ramlapisync.plugin.SpringMvcEndpointGeneratorMojo.execute (SpringMvcEndpointGeneratorMojo.java:478)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    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:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    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)
    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.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:39)
    at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:122)
    at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:55)
[ERROR]
[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```
stojsavljevic commented 6 years ago

I assume that the problem happens because schemaLocation is not resolved properly.

Maybe there is something Maven Wrapper that can help resolving relative paths.