在命令行中用
mvn package |
能构建成功,但在eclipse中用m2eclipse插件则构建失败,提示信息摘录部分如下:
[ERROR] FATAL ERROR[INFO] ------------------------------------------------------------------------[INFO] dependenciesInfo : dependenciesInfo---- Debugging information ----message : dependenciesInfo : dependenciesInfocause-exception : com.thoughtworks.xstream.mapper.CannotResolveClassExceptioncause-message : dependenciesInfo : dependenciesInfoclass : org.apache.maven.plugin.war.util.WebappStructurerequired-type : org.apache.maven.plugin.war.util.WebappStructurepath : /webapp-structure/dependenciesInfo |
在网上查了一些资料,主要参考:http://jira.codehaus.org/browse/MWAR-187
之所以命令行能成功,而插件不成功,主要原因是二者的maven版本不一样造成的,因为2eclipse使用embedded Maven 3(Maven Embedder 3.0.-SNAPSHOT),可以通过window->perferences->Maven->Installations查看到。
解决这个问题的方法在上文链接中也有提到:
- Maven版本降级
- 最快捷的方式是禁用缓存(webapp-cache.xml)
- 在eclipse中用m2eclipse插件,先运行mvn clean后(这样会删除target目录),再运行mvn install
<configuration> <useCache>false</useCache></configuration> |