使用intellij创建项目的整个过程如下:
首先,点击intllij的.exe文件,如果是第一次安装,选择第二个选项即可
![](https://app.yinxiang.com/shard/s72/res/f4c41e0f-fd4c-43cc-998c-19b65fbd9c17.png)
Intellij需要license key,可以使用注册机生成相应的name和key,如果是在公司,可以使用公司提供的name和key
![](https://app.yinxiang.com/shard/s72/res/01965905-3e71-4d33-adf8-116bdeb9bce6.png)
![](https://app.yinxiang.com/shard/s72/res/b405a574-458b-459f-b10a-fa1929d53f1e.png)
配置主题,也可以之后在项目的setting中配置
![](https://app.yinxiang.com/shard/s72/res/86f68c71-9c99-431c-bc65-3ee923a2dc5b.png)
点击每一个项目,选择自己需要的插件,不要全选,否则每次启动会花很长时间
![](https://app.yinxiang.com/shard/s72/res/db6e3021-3a97-4c06-9e35-0763ab1843ba.png)
![](https://app.yinxiang.com/shard/s72/res/1b9b423c-c432-4cf0-a00c-5d624fdc1e08.png)
进入Intellij后,现在configure中进行一些配置,不要急着创建项目
![](https://app.yinxiang.com/shard/s72/res/eade336a-456f-44e0-abcc-a4826290aa2f.png)
点击settings之后出现以下界面,之前的配置也可以放在这边配,一样的
Appearance中的Theme可以配置主题,KeyMap可以配置快捷键,自己根据需要调节即可,把一些重要的配置在这里配一下
![](https://app.yinxiang.com/shard/s72/res/1b1ce888-f0ec-4f22-b92f-ecf5ce053d9c.png)
配置1:enconding,把所有的设置成UTF-8
![](https://app.yinxiang.com/shard/s72/res/72b90e22-43eb-4e14-9bc8-fe6fd5c2fae1.png)
配置2:配置一下maven
原本的maven是这样设置的
![](https://app.yinxiang.com/shard/s72/res/eb6d4853-a475-4970-bce3-6bbc0267067d.png)
如果直接用maven默认的repository地址,就这样设置,记得要先下载maven,同时配置maven的环境变量
![](https://app.yinxiang.com/shard/s72/res/857e172f-4d54-4c24-b493-66c4bdd7cf74.png)
![](https://app.yinxiang.com/shard/s72/res/6dedd6a1-7b4d-4391-8995-64bbbd98a1ee.png)
在path路径下配置:%MAVEN_HOME%in;
在cmd下查看是否配置成功:
![](https://app.yinxiang.com/shard/s72/res/4f8d68f1-d4ad-44b6-946e-ad42128d0ceb.png)
看到maven的相关信息就可以了
如果将repository放在c盘下,想另放一处,即修改maven的默认仓库,就要修改如下配置:
打开apache-maven-3.3.3,找到config下的setting.xml,可以看到有一个localRepository,默认的就是m2中的repository,这里我们要修改为自己的地址:
![](https://app.yinxiang.com/shard/s72/res/948ddb68-f267-490d-87d4-93433fd341dd.png)
修改如下:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>D: 1.softwares12.MavenMavenapache-maven-3.2.1 epository</localRepository>
<!-- localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository
<localRepository>/path/to/local/repo</localRepository>
-->
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>D: 1.softwares12.MavenMavenapache-maven-3.2.1 epository</localRepository>
<!-- localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository
<localRepository>/path/to/local/repo</localRepository>
-->
然后将上面的local repository设置为:D: 1.softwares12.MavenMavenapache-maven-3.2.1
epository
这样就完成了默认仓库地址的修改
配置3:配置git,找到自己下载的git的git.exe
![](https://app.yinxiang.com/shard/s72/res/e8f6a033-cf7e-4315-84e5-44acf507849d.png)
然后创建一个新项目:
![](https://app.yinxiang.com/shard/s72/res/7a17b6e0-d292-4298-9b11-bdbe542c5135.png)
这里创建一个maven项目,会弹出防火墙警告,这里要选择“允许访问”
![](https://app.yinxiang.com/shard/s72/res/e3bdffec-47e5-4e71-810a-840785ebdd42.png)
配置Project SDK,找到自己的JDK,要注意JDK的版本:
![](https://app.yinxiang.com/shard/s72/res/86c14cd8-e275-4163-806b-6ca2d9a54ebe.png)
环境变量也要设置好:
![](https://app.yinxiang.com/shard/s72/res/4741337f-3d3c-44a4-bd4f-dad0a8d8516a.png)
path下配置一下:d:jdk7in;D:jdk7jrein
配置好之后,勾选Create from archetype,这样就可以在项目中添加web目录
![](https://app.yinxiang.com/shard/s72/res/0d6444a7-e09c-46b4-a252-06f01109b297.png)
next之后,填写maven的GroupId和ArtifactId,以及项目名称即可
![](https://app.yinxiang.com/shard/s72/res/1e0c9ab8-c1f0-4861-865d-dfe5bb41bd8e.png)
![](https://app.yinxiang.com/shard/s72/res/4b8b0a76-71ea-4c92-8cfa-daf0aed91c71.png)
成功创建一个project,如图,记得要等程序把maven的依赖加载进来,如果你在前面添加的配置过程中选择的插件较多,就需要多花点时间了。
![](https://app.yinxiang.com/shard/s72/res/33b39e5b-e2b1-46a5-a3c8-f4852bbc3ff2.png)
选中view中的toolbar和Tool Buttons,就会在右边栏和底侧出现
![](https://app.yinxiang.com/shard/s72/res/754a422f-040e-481e-b735-535915202048.png)
继续配置,选中Edit Configuration
![](https://app.yinxiang.com/shard/s72/res/e3505924-7641-4764-83e4-48ae6a94f102.png)
创建一个module,名称为example1,整个项目如图:
![](https://app.yinxiang.com/shard/s72/res/17877891-4f9e-4f93-a34c-9534f4d43943.png)
点击Configure,配置tomcat,找到自己下载的tomcat
![](https://app.yinxiang.com/shard/s72/res/b738f414-1208-419b-b1af-86091e2d6512.png)
![](https://app.yinxiang.com/shard/s72/res/f61c07e5-f033-4f3d-af16-ca02b09e1d10.png)
以后可以通过+ -号调整tomcat配置
在server下的配置主要如下:
![](https://app.yinxiang.com/shard/s72/res/8965f9da-8307-4229-ba61-4e3fdb39078b.png)
转到Deployment进行配置
![](https://app.yinxiang.com/shard/s72/res/1d08cd84-969f-42ce-9254-ba03d9dfb950.png)
配置deployment的artifact,有时会出现这种情况:
![](https://app.yinxiang.com/shard/s72/res/bda79251-493f-4136-aef9-2e173eb5f92c.png)
只有External Source,没有artifact,可以这样解决:
打开Project Structre,选择Artifact选项, 点击+号,选择Web Application:Exploded
![](https://app.yinxiang.com/shard/s72/res/e6ef44f2-6149-4338-a533-11d143f4be11.png)
注意有以下几个地方需要设置:
![](https://app.yinxiang.com/shard/s72/res/1e0b93c8-e12b-499d-baaf-20b814c958cc.png)
此时再转到Edit Configuration配置tomcat的Deployment,就可以看到Artifact选项了
![](https://app.yinxiang.com/shard/s72/res/a78fd0da-b284-4690-b794-b0d79e0c38b3.png)
点击即可
![](https://app.yinxiang.com/shard/s72/res/2c1d2fdd-b678-42e5-b26e-704c9c41e0bc.png)
具体的tomcat配置可以参考官方教程:https://www.jetbrains.com/help/idea/2016.2/run-debug-configuration-tomcat-server.html
配置好之后就可以点击tomcat运行项目,如图:
![](https://app.yinxiang.com/shard/s72/res/e7835e8c-6642-4cad-9f98-3e71de3af39b.png)