`
Phoenix_MVP
  • 浏览: 336896 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

【Problem】webxml attribute is required

阅读更多

问题:maven构建工程时报错webxml attribute is required

 

错误信息:

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode)
  

说明:

In general, for a Java-based Maven project, non-source files should go in the src/main/resourcessub-directory of the project. The contents of that resources directory are copied to the output directory (by default, target/classes) during the process-resources phase of the build.

For Maven WAR projects, it is slightly more complicated: there is also the src/main/webapp directory, wherein Maven expects to find WEB-INF/web.xml. To build your WAR file, that file must exist; otherwise, you'll see an error message like that:

As the WEB-INF directory must exist under src/main/webapp, I'd recommend avoiding defining it again in src/main/resources. Although this is perfectly valid and the contents of the two directories will be merged, it can get confusing if a file is defined in both. The contents of src/main/resourceswill take precedence as they are copied over the top of the contents from src/main/webapp.

 

解决方案:

在WEB-INF/web.xml中增加一个web.xml用于占位

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics