It would appear that setting the property "file.resource.loader.path" to an
empty string did the trick, namely:
props.setProperty("file.resource.loader.path", "");
Interestingly, simply NOT setting the value to start with, did not work.
So, now I can do this:
Velocity.mergeTemplate(file.getCanonicalPath(), "UTF-8", context, writer);
Where "file" is a java.io.File object that is passed in from Maven.
-Chris
Chris Graham wrote:
>
> Hi All.
>
> I am attempting to write a Maven plugin that is executed as part of a
> build against other projects.
>
> I am attempting to use Velocity to execute templates that are contained in
> the *other* project, not the one that I am writing that contains the
> Velocity code.
>
>
> <build>
> <plugins>
> <plugin>
> <groupId>org.codehaus.mojo</groupId>
> <artifactId>properties-maven-plugin</artifactId>
> <version>1.0-alpha-3-SNAPSHOT</version>
> <executions>
> <execution>
>
> <phase>generate-resources</phase>
> <goals>
>
> <goal>update-properties</goal>
> </goals>
> <configuration>
> <files>
>
> <file>src/main/resources/application.properties</file>
> </files>
> </configuration>
> </execution>
> </executions>
> </plugin>
> </plugins>
> </build>
>
> So my plugin receives a list of File objects, of the files in the other
> project. These files are the template files that need to be processed.
>
> I am using the FileResourceLoader, but I can not get it to correctly
> process the templates. Well, not without some awful fudges.
>
> Can anyone suggest a reasonable way to process resources that are not
> local to the plugin in question?
>
> Or at least suggest a way to work with absolute paths? (that obviously
> need to work on Windows and Unix).
>
> Ta.
>
> -Chris
>
>
--
View this message in context:
http://www.nabble.com/File-Reosurce-Template-problems-and-Absolute-paths-tp25413134p25413864.html
Sent from the Velocity - Dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]