[ 
http://jira.codehaus.org/browse/MWAR-134?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_116066
 ] 

Ludovic Claude commented on MWAR-134:
-------------------------------------

I did a bit of debugging, so here are my results:

* the filter scans all files in src/main/webapp, and this includes JSP pages 
with tags like <%@ taglib ... />
* in InterpolationFilterReader.read(), the key value is "@", and the 
variableKey is ""
* for some reason, variables.get("") returns a MavenProject instance

In fact, the problem comes from the fact that plexus.utils 1.0.2 is used by the 
war plugin, while a more recent version of plexus.utils such as 1.2 doesn't try 
to cast directly the value returned by variables.get() to a String.

So the fix is quite simple here: use plexus 1.2 or better!


> ClasscastException when turning filtering on the web resources
> --------------------------------------------------------------
>
>                 Key: MWAR-134
>                 URL: http://jira.codehaus.org/browse/MWAR-134
>             Project: Maven 2.x War Plugin
>          Issue Type: Bug
>    Affects Versions: 2.0.2
>         Environment: Maven 2.0.8, Win XP
>            Reporter: Ludovic Claude
>
> Hello,
> I have configured the maven-war-plugin to filter my files in src/main/webapp, 
> in particular web.xml. 
> <plugin>
>               <groupId>org.apache.maven.plugins</groupId>
>               <artifactId>maven-war-plugin</artifactId>
>               <configuration>
>                       <archive>
>                               <addMavenDescriptor>
>                                       false
>                               </addMavenDescriptor>
>                       </archive>
>                       <webResources>
>                               <resource>
>                                       <filtering>true</filtering>
>                                       <directory>
>                                               src/main/webapp
>                                       </directory>
>                                       <includes>
>                                               <include>**/*</include>
>                                       </includes>
>                               </resource>
>                       </webResources>
>               </configuration>
>       </plugin>
> But when I run Maven, I get the following error: 
> [INFO] Copy webapp webResources to [...]\client-framework-webapp-0.2-SNAPSHOT
> [INFO] 
> ------------------------------------------------------------------------
> [ERROR] FATAL ERROR
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] org.apache.maven.project.MavenProject
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Trace
> java.lang.ClassCastException: org.apache.maven.project.MavenProject
>         at 
> org.codehaus.plexus.util.InterpolationFilterReader.read(InterpolationFilterReader.java:269)
>         at 
> org.codehaus.plexus.util.InterpolationFilterReader.read(InterpolationFilterReader.java:162)
>         at java.io.Reader.read(Reader.java:100)
>         at org.codehaus.plexus.util.IOUtil.copy(IOUtil.java:212)
>         at org.codehaus.plexus.util.IOUtil.copy(IOUtil.java:200)
>         at 
> org.apache.maven.plugin.war.AbstractWarMojo.copyFilteredFile(AbstractWarMojo.java:921)
>         at 
> org.apache.maven.plugin.war.AbstractWarMojo.copyResources(AbstractWarMojo.java:415)
>         at 
> org.apache.maven.plugin.war.AbstractWarMojo.buildWebapp(AbstractWarMojo.java:518)
>         at 
> org.apache.maven.plugin.war.AbstractWarMojo.buildExplodedWebapp(AbstractWarMojo.java:347)
>         at 
> org.apache.maven.plugin.war.WarMojo.performPackaging(WarMojo.java:164)
>         at org.apache.maven.plugin.war.WarMojo.execute(WarMojo.java:130)
>         at 
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:447)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
>         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:333)
>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:126)
>         at org.apache.maven.cli.MavenCli.main(MavenCli.java:282)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         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)
> [INFO] 
> ------------------------------------------------------------------------
> Any idea?
> Thanks,
> Ludovic

-- 
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

        

Reply via email to