工作中我们能接触的项目,一般都是别人已经做到一半的项目,所以我们不得不导入别人的项目到自己开发工具里,如idea。但是别人的思路我们是不知道的,因此会遇到很多意想不到的问题。别人愿意和你讲还好,不愿意和你讲,你就很难受了。我还是那句话:你查遍所有博客,吃遍所有不一定对症的药,就算狗屎运解决了问题,脑子也一定吃坏了,不如看看纠错过程。所以我把导入他人项分成以下几个步骤【假设你除了知道这个java项目外一无所知】:一、idea正常导入项目,选择构建方式;二、配置tomcat,fix artifacts;三、运行查看 tomcat localhost log; 三、根据tomcat localhost log纠正project structure

一、idea正常导入项目,查看 tomcat localhost log

idea正常导入项目

【错误解决】Intellj(IDEA) warning no artifacts configured推荐使用import project 导入新项目,而不是直接open。

选择构建方式

【错误解决】Intellj(IDEA) warning no artifacts configured

本案例的前提是你除了知道这是个java项目外一无所知,所以你可能需要都试试。但我依然推荐你按图上选择就可以了。然后一路next,直到finish。

二、配置tomcat,查看 tomcat localhost log

【错误解决】Intellj(IDEA) warning no artifacts configured

【错误解决】Intellj(IDEA) warning no artifacts configured

接下来是这张图,有个warning no artifacts configured,不要慌跟着提示走,点fix吧。

【错误解决】Intellj(IDEA) warning no artifacts configured

接下来到project structure界面,这是第一次和他相会,以后还有呢。点击+ ,选择运行时的mouldes,也就是你那个项目目录。

【错误解决】Intellj(IDEA) warning no artifacts configured

【错误解决】Intellj(IDEA) warning no artifacts configured

点击ok后,tomcat自动配置artifacts,跳到

【错误解决】Intellj(IDEA) warning no artifacts configured

好了,没报错了,我们以为完事大吉,进行第一次测试运行吧。

结果报错:

【错误解决】Intellj(IDEA) warning no artifacts configured

记住这个resource

三、根据tomcat localhost log纠正project structure

上图意思是说ssiconfig这个resource不存在,那好,看看这个ssicofig在哪。

发现他是resource的下级目录。

【错误解决】Intellj(IDEA) warning no artifacts configured

对比project structure 发现没有resource配置

【错误解决】Intellj(IDEA) warning no artifacts configured

那我们就加上

【错误解决】Intellj(IDEA) warning no artifacts configured

当然我也可以只把ssiconfig设为resource,别的目录再报错再加。但我发现resource下别的内容也是resource,就一起设了。run项目

【错误解决】Intellj(IDEA) warning no artifacts configured

之后正常了。至于日志乱码,那就是另一个故事了,添加一个-Dfile.encoding=utf-8就可以了

【错误解决】Intellj(IDEA) warning no artifacts configured

相关文章: