zaplatynski / fsm-packagetype

A basic approach to a Maven package type for FirstSpirit modules
https://zaplatynski.github.io/fsm-packagetype/
Apache License 2.0
3 stars 2 forks source link

unable to find resource module.vm in flat project structure #8

Open alexalbr opened 7 years ago

alexalbr commented 7 years ago

Hi,

i have a multi module project with flat project structure. In this case the module.vm file is found but velocity has problems loading the file as a resource.

In the attachment is a sample project which demonstrates the problem.

Here is the Stacktrace: [ERROR] Failed to execute goal com.github.zaplatynski:fsm-packagetype:2.3.0:moduleXml (default-moduleXml) on project fsm: Unable to find resource 'fsm/src/main/fsm/module.vm' -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.zaplatynski:fsm-packagetype:2.3.0:moduleXml (default-moduleXml) on project fsm: Unable to find resource 'fsm/src/main/fsm/module.vm' at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212) 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:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) at org.apache.maven.cli.MavenCli.main(MavenCli.java:199) 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 org.codehaus.classworlds.Launcher.main(Launcher.java:47) Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to find resource 'fsm/src/main/fsm/module.vm' at com.github.zaplatynski.firstspirit.modules.fsm.velocity.ModuleXmlParser.parseModuleVm(ModuleXmlParser.java:68) at com.github.zaplatynski.firstspirit.modules.fsm.ModuleXmlMojo.execute(ModuleXmlMojo.java:57) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) ... 21 more Caused by: org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'fsm/src/main/fsm/module.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 com.github.zaplatynski.firstspirit.modules.fsm.velocity.VelocityManager.renderModuleXml(VelocityManager.java:43) at com.github.zaplatynski.firstspirit.modules.fsm.velocity.ModuleXmlParser.parseModuleVm(ModuleXmlParser.java:66) fsm.zip

zaplatynski commented 7 years ago

Hey Alex, thank you for this issue and you pull request. I will do some testing to see if this still works on a nested multi Maven project setup. If everything will be fine then expect a new version in a new days.