Velocity. Can't load my resources

java, maven, velocity

Solution

I solved my problem.

    VelocityEngine ve = new VelocityEngine();
    Properties properties = new Properties();
    properties.setProperty("resource.loader", "file");
    properties.setProperty("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
    ve.init(properties);

Problem

structure of my project: ``` -src --main ---java ----makers -----SomeClass ---resources ----htmlPattern.vm ``` How tell to SomeClass about htmlPattern. I try something like this: ``` VelocityEngine ve = new VelocityEngine(); Properties properties = new Properties(); properties.setProperty("resource.loader", "file"); properties.setProperty("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.FileResourceLoader"); properties.setProperty("file.resource.loader.path", "resources"); properties.setProperty("file.resource.loader.cache", "true"); properties.setProperty("file.resource.loader.modificationCheckInterval", "2"); ve.init(properties); Template t = ve.getTemplate("htmlPattern.vm", "utf-8"); ``` What's wrong? The IDE says: ``` org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'htmlPattern.vm' ```

Original source