Java7、Maven2でwar化できなかったときの対応

Maven2.2.1、jdk1.7.0_05-b05で「mvn war:war」とかやったら以下のようなエラーが出た。

[INFO] Packaging webapp
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor
---- Debugging information ----
message             : Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor
cause-exception     : com.thoughtworks.xstream.converters.reflection.ObjectAccessException
cause-message       : Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor
class               : org.apache.maven.plugin.war.util.WebappStructure
required-type       : org.apache.maven.plugin.war.util.WebappStructure
path                : /webapp-structure
line number         : 1
-------------------------------

なんぞーと思ってぐぐったらstackoverflowにこんなのが。
Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor - Stack Overflow


こんなの追加すればいけるよって書いてあるんですけど、maven-war-plugin自体は使ってたのでversionだけを追記してみました。

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.1.1</version>
</plugin>


いざ!

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------

いけた!

スポンサーリンク