1.解决之前项目结构如下:
![](https://upload-images.jianshu.io/upload_images/1802116-fe30952de933d2b5.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
2.选择File->Project Structure...
![](https://upload-images.jianshu.io/upload_images/1802116-17d277b92f40515a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
3.选择Modules选项卡下面的Sources项,在main文件夹上右键,选择New Folder...并点击OK
![](https://upload-images.jianshu.io/upload_images/1802116-f8e85816ee72374e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
4.输入要创建的文件夹名称java,并点击OK继续
![](https://upload-images.jianshu.io/upload_images/1802116-1270dfcdb39e3e50.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
5.在创建好的java文件夹上右键选择Sources项将该文件夹标记为源文件夹
![](https://upload-images.jianshu.io/upload_images/1802116-f570c720aa64584f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
6.我们发现java文件夹已经由黄色变成了蓝色,我们点击OK按钮表示设置完成。
![](https://upload-images.jianshu.io/upload_images/1802116-e1d67e71195acc30.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
7.设置完成后的项目结构如下:
![](https://upload-images.jianshu.io/upload_images/1802116-a9eb50507023e269.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
这正是我们标准Maven项目的结构,完美!至此我们就解决了Idea创建maven-archetype-webapp项目无java目录的问题