---
title: "intellij idea maven"
author: "tangxininjava"
date: "2016-05-16T15:11:06Z"
tags: []
categories: ["开源软件"]
slug: "intellij-idea-maven"
draft: false
lastmod: "2016-05-16T15:11:06Z"
id: 2298515
url: "https://tangxininjava.iteye.com/blog/2298515"
---

intellij idea 添加maven project：

 

1.File new Project 选择Maven 勾选Create from archetype 选择列表中的maven-archetype-webapp

2.next 填写GroupId ArtifactId next

3.在Maven home directory这个页面中最下面有个Properties中添加 archetypeCatalog=internal 

 

4.配置tomcat 如图：

![](http://dl2.iteye.com/upload/attachment/0117/4462/054c3c24-a6b8-3b4a-9326-acd78633cf6b.png)  
 

如上图选择Deployment,这个时候你会发现无法添加test项目，这是为什么呢？

这是maven和tomcat之间的关系，maven加载web项目，maven项目中的artifactId生成，

所以我们使用以下步骤解决：

 

打开intellij idea 右侧的Maven Projects 如下图：

![](http://dl2.iteye.com/upload/attachment/0117/4466/8d4f6d60-b5df-36a5-8a13-45b229162b1d.png)  
 点击clean后，

![](http://dl2.iteye.com/upload/attachment/0117/4468/18f4b049-0529-3fe0-b041-dd6ac8d5a8ad.png)  
 

然后这样就可以构建一个简单的maven项目了。