Hi
In the POM file when we configure the templateDirectoy using the ${basedir}
variable, maven crash with the folloing error:
[ERROR] Failed to execute goal org.apache.avro:avro-maven-plugin:1.7.7:schema
(default) on project model: Execution default of goal
org.apache.avro:avro-maven-plugin:1.7.7:schema failed:
org.apache.velocity.excepteNotFoundException: Unable to find resource
'C:\****/resources/avro/templates/record.vm' -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal
org.apache.avro:avro-maven-plugin:1.7.7:schema (default) on project model:
Execution default of goal org.apache.avro:avro-maven-pluginma failed:
org.apache.velocity.exception.ResourceNotFoundException: Unable to find
resource 'C:\****/resources/avro/templates/record.vm'
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at
org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
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:483)
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.apache.avro:avro-maven-plugin:1.7.7:schema failed:
org.apache.velocity.exception.ResourceNotFoundException: Unable to
findC:\Project\realtime-dashboard\model\src\main\resources\avro\templates\record.vm'
at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:143)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: java.lang.RuntimeException:
org.apache.velocity.exception.ResourceNotFoundException: Unable to find
resource
'C:\Project\realtime-dashboard\model\src\main\resources\avro\templates\record.vm'
at
org.apache.avro.compiler.specific.SpecificCompiler.renderTemplate(SpecificCompiler.java:340)
at
org.apache.avro.compiler.specific.SpecificCompiler.compile(SpecificCompiler.java:380)
at
org.apache.avro.compiler.specific.SpecificCompiler.compileToDestination(SpecificCompiler.java:327)
at org.apache.avro.mojo.SchemaMojo.doCompile(SchemaMojo.java:82)
at
org.apache.avro.mojo.AbstractAvroMojo.compileFiles(AbstractAvroMojo.java:216)
at
org.apache.avro.mojo.AbstractAvroMojo.execute(AbstractAvroMojo.java:165)
at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
... 20 more
Caused by: org.apache.velocity.exception.ResourceNotFoundException: Unable to
find resource
'C:\Project\realtime-dashboard\model\src\main\resources\avro\templates\record.vm'
at
org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:474)
at
org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:352)
at
org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1533)
at
org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1514)
at
org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:373)
at
org.apache.avro.compiler.specific.SpecificCompiler.renderTemplate(SpecificCompiler.java:338)
... 26 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
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :model
The configuration look like:
<configuration>
<sourceDirectory>${basedir}/src/main/resources/avro/</sourceDirectory>
<outputDirectory>${basedir}/src/main/java/</outputDirectory>
<templateDirectory>${basedir}/src/main/resources/avro/templates/</templateDirectory>
</configuration>
The fix is to specify the full path starting by "/..."
But it is not a good solution as we have several environment of development.
Do you have any way to fix that? (other than specifying the full path)
Thanks
--
Mathieu Suen