一、介绍、
接触Java 有些年头了,相信大家已经忘记了怎么创建一个不使用构建工具和任何Java Web框架的原始Java Web项目。最近接触一个老项目,就是使用很原始的方式搭建的,虽然使用了Spring的技术,但是没有使用构建工具,手工管理庞大的依赖Java 类库,而且还是Eclipse项目,习惯了IDEA,不想再用回Eclipse,而且对比把一个不使用构建工具创建的项目改成使用构建工具的项目工作量和带来的效益 ,决定还是先不要使用构建工具,只是改成IDEA项目。
二、Idea创建web项目
1.打开idea,选择file->New->Project
![Intellij IDEA创建web项目 [超详细]插图 Intellij IDEA创建web项目 [超详细]](https://pic.hicxy.com/2022/08/29f49fce3f1985b0f685ea7eb0277d8f59.png)
2.点击Java,点击下一步.
![Intellij IDEA创建web项目 [超详细]插图1 Intellij IDEA创建web项目 [超详细]](https://pic.hicxy.com/2022/08/29691d318c90d37ed4947a5f3580f6d32d.png)
3.修改项目名。
![Intellij IDEA创建web项目 [超详细]插图2 Intellij IDEA创建web项目 [超详细]](https://pic.hicxy.com/2022/08/29ab966a820077b66da35e89a9a3aa201b.png)
4. 右键项目,选择add framework support
![Intellij IDEA创建web项目 [超详细]插图3 Intellij IDEA创建web项目 [超详细]](https://pic.hicxy.com/2022/08/298f302ff41b062b7a6d69df83686d92a6.png)
5. 完成之后,项目结构变成了这样
![Intellij IDEA创建web项目 [超详细]插图4 Intellij IDEA创建web项目 [超详细]](https://pic.hicxy.com/2022/08/2983f990fd755490519099e9b6cefd4e55.png)
6. 接下来,我们在WEB-INF下创建classes和lib文件夹
![Intellij IDEA创建web项目 [超详细]插图5 Intellij IDEA创建web项目 [超详细]](https://pic.hicxy.com/2022/08/29a2c1acd1b7133453ac489a519673f310.png)
7. 编辑项目结构, 将output path的路径改成classes文件夹的路径
![Intellij IDEA创建web项目 [超详细]插图6 Intellij IDEA创建web项目 [超详细]](https://pic.hicxy.com/2022/08/29b5257a1d06af1b634d22db472aae0e73.png)
![Intellij IDEA创建web项目 [超详细]插图7 Intellij IDEA创建web项目 [超详细]](https://pic.hicxy.com/2022/08/2911fcff2c118259bebdc25674b534b789.png)
8. 点击dependencies,选择加号,选择jars or directories, 点击后,他会弹出一个文件选择框,这里选择lib文件所在位置,如图所示:
![Intellij IDEA创建web项目 [超详细]插图8 Intellij IDEA创建web项目 [超详细]](https://pic.hicxy.com/2022/08/29435f2edaec876a2ec7f0adc9f5fb2168.png)
![Intellij IDEA创建web项目 [超详细]插图9 Intellij IDEA创建web项目 [超详细]](https://pic.hicxy.com/2022/08/298451d17d3584fcdd3efd694d168b8cee.png)
![Intellij IDEA创建web项目 [超详细]插图10 Intellij IDEA创建web项目 [超详细]](https://pic.hicxy.com/2022/08/297cb5e6af42f03db5ae6e1df1d2882bba.png)
9. 配置web容器
![Intellij IDEA创建web项目 [超详细]插图11 Intellij IDEA创建web项目 [超详细]](https://pic.hicxy.com/2022/08/2926afdad725e6ee627906b56edf6ace20.png)
![Intellij IDEA创建web项目 [超详细]插图12 Intellij IDEA创建web项目 [超详细]](https://pic.hicxy.com/2022/08/29e5de49f5950a53112ca62de789f53c02.png)
![Intellij IDEA创建web项目 [超详细]插图13 Intellij IDEA创建web项目 [超详细]](https://pic.hicxy.com/2022/08/299db7278258ffe02c8c29f3aeaa51c6cf.png)
10. 这样我们就配置完成了,点击运行项目。
![Intellij IDEA创建web项目 [超详细]插图14 Intellij IDEA创建web项目 [超详细]](https://pic.hicxy.com/2022/08/292306006a9a5cd50f01862d13f1ddb123.png)
三、总结、
感谢大家的关注 点赞 收藏
相关文章
暂无评论...
