idea创建普通Web项目lib目录无法输出,tomcat不报错问题
idea创建普通Web项目lib目录无法输出,tomcat不报错问题
idea版本:2021.2
tomcat版本:9.0.50
项目结构
创建一个普普通通的web项目,目录结构大概就是这样
.
├── .idea
│ ├── artifacts
│ ├── inspectionProfiles
│ ├── libraries
│ └── sonarlint
│ └── issuestore
├── conf
├── lib
├── out
│ ├── artifacts
│ │ └── test03_war_exploded
│ │ └── WEB-INF
│ │ ├── classes
│ │ │ └── top
│ │ │ └── ctong
│ │ │ └── controller
│ │ └── lib
│ └── production
│ └── test03
│ ├── generated
│ └── top
│ └── ctong
│ └── controller
├── src
│ └── top
│ └── ctong
│ └── controller
└── web
└── WEB-INF
lib
文件夹已经设置为Library
文件夹。
controller
搞了个hello
请求
@Controller
public class TestController implements Serializable {
private static final long serialVersionUID = 6290967590153117614L;
@RequestMapping("/hello")
public void test01() {
System.out.println("Hello World!");
}
}
配置了自动包扫描
<?xml version="1.0" encoding="UTF-8"?>
加载了DispatcherServlet
<?xml version="1.0" encoding="UTF-8"?>
dispatcherServlet
org.springframework.web.servlet.DispatcherServlet
contextConfigLocation
classpath:springmvc.xml
dispatcherServlet
/
问题
点启动,访问/hello
成功荣获404….干掉out
目录重启….404…
重新建一个项目,启动…..hello world
…..
再创建新项目,启动…404
…
打开FileMerge
文件对比工具…嗯?差不多啊…
…打开out
文件夹,嗯?怎么lib目录没加进来…
…反反复复2天后…
解决
尝试将lib
目录拖进web/WEB-INF
目录…hello world
…
不信邪,再把lib
拖到项目根目录…404
…
……MMP……我之前一直这样都没问题…
不知道第几次打开 idea === >> Proiect Structure…
无意间点了 Proiect Settings ===>> Artifacts…嗯?怎么有警告…..
Library lib ' required for module test03 is missing from the artifact
嗯?莫名其妙双击了右边的lib
。警告消失了…
启动…hello world
…
什么妖魔鬼怪…