maven build报错解决方案



maven打包成war时,报错:Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-war) on project web_nanchang: Error assembling WAR: webxml attribute is required
原因:找不到web.xml,但是项目中明明有这个文件,在WebContent/WEB-INF/文件夹下,就是识别不了
解决方法:
需要在pom.xml文件中,加上maven-war-plugin插件配置
节点中增加:


       
            org.apache.maven.plugins
            maven-war-plugin
            2.4
           
               
                   
                        WebContent
                   

               

           

       

   


如果项目中原本没有web.xml文件,就需要加上下面的配置:


       
            org.apache.maven.plugins
            maven-war-plugin
            2.4
           
                false
           

       

   



你可能感兴趣的:(maven build报错解决方案)