Custom velocity template error: unable to find resource 'maven.vm' in any class 
loader
--------------------------------------------------------------------------------------

         Key: MNG-1555
         URL: http://jira.codehaus.org/browse/MNG-1555
     Project: Maven 2
        Type: Bug
  Components: maven-site-plugin  
    Versions: 2.0    
 Environment: windows xp
    Reporter: Alexander Hars


It should be possible to define a custom velocity template to be used for site 
generation. 
But when such a template is created and placed in src/site/resources, this 
leads to 
a UrlClassLoader error. 

I just extracted the maven.vm from the site plugin, placed it in 
src/site/resources/ and changed 
the pom as follows:

    <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-site-plugin</artifactId>
       <configuration>
         
        
<templateDirectory>file://${basedir}/src/site/resources/</templateDirectory>
         <template>maven.vm</template>
       </configuration>
    </plugin>  

This did not work. Maven reported that it was not able to find the 
template. (Error message is below).

...
[INFO] Velocimacro : initialization complete.
[INFO] Velocity successfully started.
[INFO] [site:site]
[INFO] Generate "Continuous Integration" report.
[ERROR] ResourceManager : unable to find resource 'maven.vm' in any 
resource loa
der.
[INFO] 
-------------------------------------------------------------------------
---
[ERROR] BUILD ERROR
[INFO] 
-------------------------------------------------------------------------
---
[INFO] Error during page generation

Embedded error: Could not find the template 'maven.vm' in 
java.net.URLClassLoade
[EMAIL PROTECTED]
[INFO] 
-------------------------------------------------------------------------
---
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Error during 
page genera
tion
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:544)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLi
fecycle(DefaultLifecycleExecutor.java:469)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau
ltLifecycleExecutor.java:448)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
dleFailures(DefaultLifecycleExecutor.java:301)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
ts(DefaultLifecycleExecutor.java:268)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
fecycleExecutor.java:137)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:316)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:113)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:249)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at 
org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at 
org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)

        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error during 
page gen
eration
        at org.apache.maven.plugins.site.SiteMojo.execute(SiteMojo.java:393)
        at 
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi
nManager.java:399)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:519)
        ... 16 more
Caused by: org.codehaus.plexus.siterenderer.RendererException: Could not 
find th
e template 'maven.vm' in [EMAIL PROTECTED]
        at 
org.codehaus.plexus.siterenderer.DefaultSiteRenderer.writeTemplate(De
faultSiteRenderer.java:345)
        at 
org.codehaus.plexus.siterenderer.DefaultSiteRenderer.generateDocument
(DefaultSiteRenderer.java:316)
        at 
org.apache.maven.plugins.site.SiteMojo.generateReportsPages(SiteMojo.
java:813)
        at org.apache.maven.plugins.site.SiteMojo.execute(SiteMojo.java:301)
        ... 18 more
[INFO] 
-------------------------------------------------------------------------
---
[INFO] Total time: 12 seconds
[INFO] Finished at: Fri Nov 11 16:59:42 CET 2005
[INFO] Final Memory: 6M/11M
[INFO] 
-------------------------------------------------------------------------
---

---------------------------------------------------------------------

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to