Skip to content

Commit deb9fcf

Browse files
authored
Update maven-project.md
修改图片存储路径
1 parent 12847e9 commit deb9fcf

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

articles/maven-project.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,92 +2,92 @@
22

33
Maven 是一个优秀的项目管理工具,它为我们提供了一个构建完整的生命周期框架。现在,就让我们一起看看如何利用 IntelliJ IDEA 快速的创建 Maven 项目吧!
44

5-
![firstpage](https://img-blog.csdn.net/20180420201412371)
5+
![create-new-project](https://github.com/guobinhit/intellij-idea-tutorial/blob/master/images/maven-project/create-new-project.png)
66

77
如上图所示,点击`Create New Project`
88

9-
![maven](https://img-blog.csdn.net/20180420201516200)
9+
![new-project](https://github.com/guobinhit/intellij-idea-tutorial/blob/master/images/maven-project/new-project.png)
1010

1111
- **标注 1**`Maven`选项;
1212
- **标注 2**`Project SDK`,项目 SDK;
1313
- **标注 3**`archetype`,Web 项目框架。
1414

1515
如上图所示,先点击 Maven 选项,然后选择 SDK,再从框架中选择`maven-archetype-webapp`用于创建 Web 项目。当然,我们也可以根本不同的需求选择不同的框架以便 IDEA 自动为我们生成项目框架。在这里,有一点需要我们特别注意,那就是:**`Maven 3.3.1+`以上的版本需要`JDK 1.7+`以上的版本与之搭配使用**,否则会出现异常,以至于 Maven 项目创建失败。在上述操作完成后,点击`Next`
1616

17-
![project](https://img-blog.csdn.net/20180420202703102)
17+
![new-project-2](https://github.com/guobinhit/intellij-idea-tutorial/blob/master/images/maven-project/new-project-2.png)
1818

1919
- **标注 1**`GroupId`,项目坐标,与`ArtifactId`搭配使用,用于标记项目;
2020
- **标注 2**`ArtifactId`,项目坐标,与`GroupId`搭配使用,用于标记项目;
2121
- **标注 3**`Version`,项目版本,与`ArtifactId``GroupId`搭配使用,用于唯一标记项目。
2222

2323
如上图所示,`ArtifactId``GroupId`需要我们自己命名,`Version`默认为`1.0-SNAPSHOT`,表示该项目属于不稳定的快照版本,默认即可。输入完成后,点击`Next`
2424

25-
![new](https://img-blog.csdn.net/20180420203233471)
25+
![new-project-3](https://github.com/guobinhit/intellij-idea-tutorial/blob/master/images/maven-project/new-project-3.png)
2626

2727
- **标注 1**`Maven home directory`,Maven 主目录,即最外层目录;
2828
- **标注 2**`User settings file`,Maven 配置文件;
2929
- **标注 3**`Local repository`,Maven 本地仓库,用于存储依赖包。
3030

3131
如上图所示,依次配置完之后,点击`Next`
3232

33-
![location](https://img-blog.csdn.net/20180420203909404)
33+
![new-project-4](https://github.com/guobinhit/intellij-idea-tutorial/blob/master/images/maven-project/new-project-4.png)
3434

3535
- **标注 1**`Project name`,项目名称;
3636
- **标注 2**`Project location`,项目保存位置;
3737
- **标注 3**`More Settings`,更多配置,如配置项目模块位置、项目格式等。
3838

3939
如上图所示,我们将`Project name``Module name`统一命名为`gitcode`,依次配置完之后,点击`Next`
4040

41-
![start](https://img-blog.csdn.net/201804202042547)
41+
![gitcode](https://github.com/guobinhit/intellij-idea-tutorial/blob/master/images/maven-project/gitcode.png)
4242

4343
- **标注 1**`.idea`,自动生成的 IDEA 配置文件;
4444
- **标注 2**`src`,自动生成的 Maven 目录结构;
4545
- **标注 3**`BUILD SUCESS`,Maven 项目创建成功的标志。
4646

4747
如上图所示,当控制台输出`BUILD SUCESS`的时候,这意味着 Maven 已经创建完成。但是,如果我们仔细观察 IDEA 自动为我们生成的 Maven 目录结构,会发现这与我们认知中的 Maven 项目的目录结构大不相同,它没有与`main`同级的`test`目录、没有`resources`目录、也没有`java`目录,甚至连源目录都没有标记出来,为啥?实际上,Maven 并没有强制我们必须创建`test``resources``java`这样的目录,之所以建立这样的目录结构,仅仅是出于我们的习惯以及方便管理项目而已。接下来,我们就手动创建`test``resources``java`这样的结构,并标记`java``Sources Root`,即源目录:
4848

49-
![file](https://img-blog.csdn.net/2018042021034569)
49+
![project-structure](https://github.com/guobinhit/intellij-idea-tutorial/blob/master/images/maven-project/project-structure.png)
5050

5151
如上图所示,以 Mac 电脑为例,依次点击`File``Project Structure`选项:
5252

53-
![structure](https://img-blog.csdn.net/20180420210507615)
53+
![modules](https://github.com/guobinhit/intellij-idea-tutorial/blob/master/images/maven-project/modules.png)
5454

5555
如上图所示,在最左边的`Project Structure`列表中选择`Modules`,再点击`Sources`进入我们的项目结构视图,然后点击`src`目录,右键呼出菜单栏,点击`New Folder`即可创建新目录:
5656

57-
![test](https://img-blog.csdn.net/20180420210812226)
57+
![modules-2](https://github.com/guobinhit/intellij-idea-tutorial/blob/master/images/maven-project/modules-2.png)
5858

5959
如上图所示,这就是我们新创建的目录结构。
6060

61-
![Mark](https://img-blog.csdn.net/20180420211250599)
61+
![modules-3](https://github.com/guobinhit/intellij-idea-tutorial/blob/master/images/maven-project/modules-3.png)
6262

6363
现在,选择`java`目录,点击`Mark as: Sources`即可将`java`目录标记为源目录:
6464

65-
![resource](https://img-blog.csdn.net/20180420211513267)
65+
![modules-4](https://github.com/guobinhit/intellij-idea-tutorial/blob/master/images/maven-project/modules-4.png)
6666

6767
如上图所示,以同样的方法,我们相继标记了`Tests``Resources``Test Resources`目录,其中`webapp`目录比较特殊,需要我们将其标记为 Web 的项目的资源目录。在这里,点击`gitcode`上面的`+`选项:
6868

69-
![Modulejia](https://img-blog.csdn.net/20180420211951230)
69+
![modules-5](https://github.com/guobinhit/intellij-idea-tutorial/blob/master/images/maven-project/modules-5.png)
7070

7171
- **标注 1**`+``Add`选项;
7272
- **标注 2**`Web`,项目类型。
7373

7474
如上图所示,依次点击`+`选项以及`Web`类型:
7575

76-
![descriptor](https://img-blog.csdn.net/20180420212425404)
76+
![modules-6](https://github.com/guobinhit/intellij-idea-tutorial/blob/master/images/maven-project/modules-6.png)
7777

7878
- **标注 1**:修改按钮;
7979
- **标注 2**:快捷目录选项。
8080

8181
如上图所示,`Deploy Descriptor`需要指向项目的`web.xml`文件,一般情况下,默认的目录都是不准确,需要我们重新选择。
8282

83-
![directories](https://img-blog.csdn.net/20180420212732712)
83+
![modules-7](https://github.com/guobinhit/intellij-idea-tutorial/blob/master/images/maven-project/modules-7.png)
8484

8585
- **标注 1**:修改按钮;
8686
- **标注 2**:快捷目录选项。
8787

8888
如上图所示,`Web Resources Directories`需要指向项目的资源目录即`webapp`目录,与`Deploy Descriptor`一样,需要我们重新选择。
8989

90-
![success](https://img-blog.csdn.net/20180420213300739)
90+
![gitcode-success](https://github.com/guobinhit/intellij-idea-tutorial/blob/master/images/maven-project/gitcode-success.png)
9191

9292
如上图所示,至此 Maven 项目创建完成,`java`源目录设置成功。
9393

0 commit comments

Comments
 (0)