Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ResourceManager unable to find resource in multi-module project #7

Closed
GoogleCodeExporter opened this issue Oct 27, 2015 · 3 comments
Closed

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Create a multi-module project where at least 2 modules use the Velocity 
plugin to process different templates.
2. Build the multi-module project (parent of the 2 modules).

What is the expected output? What do you see instead?
Projects should build correctly.
Instead, the first module succeeds, the second fails with the following error:
[ERROR] ResourceManager : unable to find resource 
'src/main/resources/sample.vm' in any resource loader.

What version of the product are you using? On what operating system?
Version 1.1.0 on Linux and Windows.

Please provide any additional information below.
This is caused by the use of a singleton Velocity engine, which can only be 
initialized once (while building the first module). Separate instances of 
VelocityEngine should be used instead (see 
http://velocity.apache.org/engine/releases/velocity-1.7/developer-guide.html#sep
arate).

The attached patch fixes this issue.

Original issue reported on code.google.com by fcres...@gmail.com on 4 Jan 2014 at 1:07

Attachments:

@vdubus
Copy link
Owner

vdubus commented Oct 27, 2015

Fix the bug using attachments patch.

@vdubus vdubus closed this as completed Oct 27, 2015
@RoRoche
Copy link

RoRoche commented Apr 7, 2021

Hello,

do you have a configuration of a working example?

I'm facing an issue when trying to look for templates in the parent src folder.
It appends the file path I give to the relative basedir. So the folder does not exist obviously.

Here is my pseudo-file-structure:

project/
├── pom.xml
├── src/
│   ├── site/
│   │   ├── site.xml.vm
├── child1/
│   ├── pom.xml
└── child2/
│   ├── pom.xml

And here is my configuration in the root pom.xml, in the build/plugins section:

<plugin>
  <groupId>com.github.vdubus</groupId>
  <artifactId>velocity-maven-plugin</artifactId>
  <version>1.1.2</version>
  <executions>
    <execution>
      <id>Generate site descriptor</id>
      <phase>pre-site</phase>
      <goals>
        <goal>velocity</goal>
      </goals>
      <configuration>
        <removeExtension>.vm</removeExtension>
        <templateFiles>
          <directory>${maven.multiModuleProjectDirectory}/src/site</directory>
          <includes>
            <include>site.xml.vm</include>
          </includes>
        </templateFiles>
        <outputDirectory>${basedir}/src/site</outputDirectory>
      </configuration>
    </execution>
  </executions>
</plugin>

Removing ${maven.multiModuleProjectDirectory} makes it searching in the src/site relatively to basedir, and of course it neither does not exist.

Thank you in advance.
Regards,
Romain.

@vdubus
Copy link
Owner

vdubus commented Apr 7, 2021

Sorry, I can't help you.
This version of the plugin was made to fix a few issue and make it compatible with the latest version of Velocity as the original plugin wasn't maintained anymore.
I don't work anymore for this company, nor with Velocity…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants