`

eclipse创建的maven丢失/WEB-INF/web.xml文件

阅读更多

今天开始学习maven搭建项目, 不想第一个项目构建(maven install)就出错, 错误内容如下:

[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.cnp.x8:x8:war:0.1-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ line 93, column 12
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building x8 Maven Webapp 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ x8 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ x8 ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ x8 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ x8 ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ x8 ---
[INFO] Tests are skipped.
[INFO] 
[INFO] --- maven-war-plugin:2.4:war (default-war) @ x8 ---
[INFO] Packaging webapp
[INFO] Assembling webapp [x8] in [W:\devTools\eclipse\workspace\maven\simple-webapp\target\x8]
[INFO] Processing war project
[INFO] Copying webapp resources [W:\devTools\eclipse\workspace\maven\simple-webapp\src\main\webapp]
[INFO] Webapp assembled in [41 msecs]
[INFO] Building war: W:\devTools\eclipse\workspace\maven\simple-webapp\target\x8.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.198 s
[INFO] Finished at: 2015-04-18T00:18:00+08:00
[INFO] Final Memory: 12M/170M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.4:war (default-war) on project x8: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

 通过百度, 找到以下内容:


 但是在当前项目就一直没发现 /WEB-INF/web.xml 的踪迹, 仅仅在首次执行 maven install 时, 在target中有看到. 当时没注意 /main/webapp/ 下没有. 具体原因暂未找到, 目前解决方案: 手动创建 /main/webapp/WEB-INF/web.xml 文件.

 

原因已找到:


1. 默认生成的没有WEB-INF/web.xml(...quickstart)

2. 应选择 maven...webapp 选项

  • 大小: 31.4 KB
  • 大小: 75.8 KB
0
2
分享到:
评论

相关推荐

    使用Eclipse构建Maven的SpringMVC项目

    5. **配置SpringMVC**:创建src/main/webapp/WEB-INF目录,然后在其中创建web.xml文件,配置SpringMVC DispatcherServlet。例如: ```xml <web-app> ... <servlet-name>dispatcher</servlet-name> <servlet-...

    eclipse通过Maven创建一个Spring MVC项目

    步骤8:创建servlet-context.xml文件(位于src/main/webapp/WEB-INF/spring/appServlet/),这是Spring MVC的核心配置文件。配置处理器映射器、视图解析器和其他组件: ```xml <beans xmlns="http://...

    eclipse+maven创建web项目

    在`src/main/webapp/WEB-INF`下创建`web.xml`,这是Web应用的部署描述符,配置Servlet和过滤器等。例如: ```xml <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi=...

    eclipse中maven工程建maven-course项目

    在src/main/webapp/WEB-INF下创建web.xml文件,配置Spring和MyBatis的相关监听器和servlet。 完成以上步骤后,启动Tomcat服务器,运行项目。现在,"maven-course"项目已经具备了基础的CRUD功能,可以进行练习和扩展...

    jstl1.2.jar&stanard;.jar

    3. **检查TLD文件**:确保`/WEB-INF/tld/c.tld`文件存在并且指向正确的JSTL版本。这个文件通常在JSTL的库中自动包含,但如果你使用的是旧版JSTL或者自定义版本,可能需要手动添加。 4. **重启服务器**:完成上述...

    创建maven动态web工程demo

    打开"src/main/webapp/WEB-INF"目录下的web.xml文件,添加以下配置: ```xml <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=...

    3Maven创建web项目具体步骤.docx

    在创建好 Maven Web 项目后,需要在 src/main/webapp/WEB-INF 下面创建一个 web.xml 文件,并在 pom.xml 文件中添加相应的依赖项。pom.xml 文件是 Maven 项目的核心配置文件,它定义了项目的依赖关系和构建过程。 ...

    spring 4.* 缺少jar spring-cglib-repack-3.2.5.jar_spring-objenesis-repack-2.6.jar

    - 如果是传统的Java项目,可以将这两个jar文件放入WEB-INF/lib目录下,如果是Eclipse或IntelliJ IDEA这样的IDE,可以直接将jar文件添加到项目的构建路径中。 确保这些依赖正确引入后,重新构建并运行项目,通常就能...

    Eclipse使用maven搭建spring mvc源码

    7. **创建视图页面**:在`/WEB-INF/views/`目录下创建一个名为`hello.jsp`的文件,添加简单的HTML内容来显示控制器返回的消息: ```jsp <!DOCTYPE html> <title>Hello, Spring MVC</title> </head> ${message}...

    maven-web-test.zip

    本文将深入探讨如何使用Eclipse IDE创建一个Maven Web项目,并结合"Maven-web-test.zip"这个压缩包文件,理解相关知识点。 1. **Maven简介** Maven是Apache软件基金会开发的项目管理工具,它通过使用一种标准的...

    Spring mvc 环境搭建(maven构建)

    1. 在 `src/main/webapp/WEB-INF` 目录下创建 `web.xml` 文件,配置 DispatcherServlet 和 ContextLoaderListener: ```xml <web-app> <listener-class>org.springframework.web.context.ContextLoaderListener...

    快速搭建一个简易的spring web工程

    在src/main/webapp/WEB-INF下创建web.xml文件,配置Spring的DispatcherServlet: ```xml <web-app> <servlet-name>dispatcher</servlet-name> <servlet-class>org.springframework.web.servlet....

    如何在eclipse jee中创建Maven project并且转换为Dynamic web project

    - 在`Deployment Descriptor`部分,可以指定Web应用的根目录(通常默认为`/WEB-INF/web.xml`)。 - 点击`Finish`,Eclipse会自动调整项目结构,并在`src/main/webapp`目录下创建Web应用的默认目录结构。 4. **...

    eclipse创建maven项目.doc

    然而,使用"New" -> "Dynamic Web Project"创建的初始项目可能并不完善,例如,可能缺少`src/main/webapp/WEB-INF/web.xml`配置文件。你可以手动创建这个文件,或者使用Maven的Web应用骨架生成器(如`maven-war-...

    使用Eclipse构建Maven的Web项目

    这篇博客"使用Eclipse构建Maven的Web项目"将详细介绍如何利用Eclipse创建并配置一个基于Maven的Web应用程序。 首先,创建Maven Web项目需要Eclipse安装了Maven插件。这个插件通常称为"M2E"(Maven Integration for ...

    使用springmvc框架编写helloworld,使用eclispe开发工具

    <param-value>/WEB-INF/spring-mvc-config.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>dispatcher</servlet-name> <url-pattern>/...

    学位论文-—基于virgoserver进行springosgiweb开发.doc

    基于VirgoServer进行Spring Osgi Web开发需要配置VirgoServer开发环境,使用Maven和Eclipse Virgo Tools,创建Bundle Project,并配置Spring配置文件。同时,需要实现Servlet类,用于处理请求,并配置classpath和...

    axis2-eclipse-codegen-wizard.zip

    开发者只需将生成的.aar文件放入Axis2的WEB-INF/services目录下,服务即可自动被识别和加载。 5. **测试Web服务**:Axis2提供了内置的测试工具,如Axis2测试客户端(Axis2 TestClient),可以方便地对部署的服务...

    spring5.0_mvc_maven项目_HelloWorld实例

    5. **创建视图**:在`/WEB-INF/views`目录下创建一个名为`hello.jsp`的JSP页面,显示接收到的“Hello, World!”消息。 ```jsp <!DOCTYPE html> <title>HelloWorld Spring MVC</title> </head> ${message}</h1>...

    Eclipse 项目环境搭建

    该文件位于`src/main/webapp/WEB-INF`目录下。需要配置的内容包括Servlet容器的初始化参数、过滤器等。 ```xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi=...

Global site tag (gtag.js) - Google Analytics