IDEA创建基于Maven的web项目
1、先创建一个基本的Maven项目。基础的maven项目结构如下: 2、File-》Project Structure 3、新增Web模块 4、create Artifact 5、OK 6、自动生成web目录,新项目结构 7、Run -》Edit Configurations 8、Add -》Tomcat Server -》Local 9、设置Tomcat路径 10、添加部署项目 11、配置项目根路径 12、添加spring依赖,配置log4j,最终项目结构 12、运行项目,访问项目url 发生异常:ClassNotFoundException… 解决:手动“Put into Output Root”(貌似每次添加maven依赖都要操作一下) 相关配置文件 pom.xml <?xml version="1.0" encoding="UTF-8"?> < project xmlns = " http://maven.apache.org/POM/4.0.0 " xmlns: xsi = " http://www.w3.org/2001/XMLSchema-instance " xsi: schemaLocation = " http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd " >