ClassCastException
maven-war-pluginで、2.0だとIndexOutofRange例外、2.0.2だとClassCastExceptionが。
webResourcesのfilteringがあると起きる。
どうやら他の人も同じ現象にあっているけど去年からレスなしのようだ。orz
http://mail-archives.apache.org/mod_mbox/maven-users/200612.mbox/%3cOFAFB82F71.42BC0FBC-ONC125724A.006E02E3-C125724A.006F32D8@profinit.cz%3e
mayaaのページシリアライズキャッシュを配布時に除外したいだけなんだけど、filteringを書かなければwarに含んでしまうし困った。
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <configuration> <warSourceDirectory>${basedir}/src/main/webapp</warSourceDirectory> <webResources> <resource> <directory>${basedir}/src/main/webapp</directory> <!--filtering>true</filtering ←これがあるとClassCastException--> <excludes> <exclude>**/.mayaaSpecCache/*.*</exclude> </excludes> </resource> </webResources> </configuration> </plugin>
warSourceExcludesも試したがダメなようだ。
<warSourceExcludes>WEB-INF/.mayaaSpecCache</warSourceExcludes>
どうしたもんかなぁ。
追記
id:nasobemeさんに教えてもらった2.0.3-SNAPSHOTも試したがダメだった。
ただ、どちらも、directoryの指定を以下のように変えると、とりあえずClassCastExceptionでは落ちないようだ。
<directory>src/main/webapp/WEB-INF/.mayaaSpecCache</directory> <!--directory>src/main/webapp/</directory ←これだとClassCastException-->
が、excludeされるわけではないので目的を果たせてない。
それと、clean install だと例外は発生しない。clean package だと発生する。
さらに追記(解決)
同僚に教えてもらった。単にwarSourceExcludesディレクティブのフィルタの指定が悪いだけだった。
正解は以下。
<warSourceExcludes>*/.mayaaSpecCache/*</warSourceExcludes>