gpt4 book ai didi

java - 为什么我在一个全新的 webapp-javaee7 项目中出错

转载 作者:行者123 更新时间:2023-11-30 11:06:12 26 4
gpt4 key购买 nike

我通过选择 file->new->maven project->webapp-javaee7 archetype 在 Eclipse Keppler for Java EE Developers 中创建了一个项目。但是在编写一行代码之前我得到了错误:

Resource '/test/src/main/webapp/WEB-INF/web.xml' does not exist.

和:

Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-dependency-plugin:2.6:copy (execution: default, phase: validate) pom.xml /test line 53 Maven Project Build Lifecycle Mapping Problem

enter image description here

为什么没有创建 web.xml?为什么插件执行不包含在生命周期配置中?

我全新安装了 Eclipse 和最新的 M2Eclipse 插件。

最佳答案

根据关于 web.xml 部署描述符 的 ORACLE 文档,web.xml 不再是必需的,您可以改用 Java EE 注释:

来自 web.xml Deployment Descriptor Elements :

With Java EE annotations, the standard web.xml deployment descriptor is optional. According to the Servlet 2.5 specification, annotations can be defined on certain web components, such as servlets, filters, listeners, and tag handlers. The annotations are used to declare dependencies on external resources. See WebLogic Annotation for Web Components.

所以,你可以安全地忽略

Resource '/test/src/main/webapp/WEB-INF/web.xml' does not exist

错误。

但是,您可以通过右键单击项目并选择 Java EE Tools -> Generate Deployment Descriptor Stub 来创建 web.xml 文件

修复

Plugin execution not covered by lifecycle configuration

错误,您需要安装m2e connector for maven-dependency-plugin

关于java - 为什么我在一个全新的 webapp-javaee7 项目中出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29389085/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com