Eclipse内Maven项目POM报错:com.thoughtworks.xstream.io.HierarchicalStreamDriver

Eclipse中创建Maven webapp时,pom.xml文件报错,如下图


 

解决方案是在pom文件中加入maven-war-plugin

<plugins>  
        <plugin>  
            <groupId>org.apache.maven.plugins</groupId>  
            <artifactId>maven-war-plugin</artifactId>  
            <version>2.6</version>  
            <configuration>  
                <webResources>  
                    <resource>  
                        <directory>src/main/webapp/WEB-INF</directory>  
                        <filtering>true</filtering>  
                        <targetPath>WEB-INF</targetPath>  
                    </resource>  
                </webResources>  
            </configuration>  
        </plugin>  
    </plugins>

插入之后报错就会消失。

目前还搞不明白错误的具体原因是什么,猜想是maven仓库中的com.thoughtworks.xtream包不完整,而maven-war-plugin从其他地方获取了完整的包。

可以尝试手动下载xstream包到本地仓库,应该也可以解决这个问题。

猜你喜欢

转载自lichen-1989.iteye.com/blog/2206207