你是否知道怎样通过Eclipse创建maven项目?今天小编就给大家讲解一下通过Eclipse创建maven项目的方法哦,下面我们就一起去学习学习吧。
打开Eclipse软件,在打开的软件视图中,左侧是项目展示区域。
个人建议使用Package Explorer(包结构)来作为左侧的默认项目结构,可以更方便的查看maven项目结构。

开始新建项目,点击菜单 File → New → Other ,或者 右键项目区域中的空白处,然后选择 New → Other。


从弹出的New弹框中,Wizards处输入maven检索,从检索的结果中选择Maven Project,然后点击Next>。

在New Maven Project窗口中,选择框 :
□ Create a simple project(skip archetype selection) (翻译:创建一个简单项目(跳过原型选择))。如果选择这个将直接跳过maven的项目原型(模版)选择,建议不要勾选,可以使用内置的模版。

在New Maven Project窗口中,选择框 :
□ Use default workspace location (翻译:使用默认的工作区间),勾选后,建立的项目将放在默认工作区间,如不选则点击Browse(浏览),选择一个工作区间。

在New Maven Project窗口中,选择框 :
□ Add project(s) to working set (翻译:添加项目到工作集),选择则将新建的项目放入工作集中,这里的工作集概念就是项目归类,类似文件当档一样,方便区分,可选可不选。

进入下一步后:
在Filter中输入maven-archetype-webapp(建立web项目的模型)或者输入maven-archetype-quickstart(非web项目),这两种是比较常用的模型。
现在以webapp(web项目为例)。

进入下一步后:
Group Id(项目组织唯一的标识符,比如:com.****)
Artifact Id(项目的名称,根目录的名称)
Version(当前版本)
Package(默认包结构,这个可以不填)
然后点击Finish。

到这里项目就是建成了:
但是还有一些小问题需要提前处理,项目建成后,可以看出项目默认使用的是jdk1.5,这是因为我们使用的原型是比较早的版本所致。

我们要更换jdk:
右键新建立的项目,在右键菜单中选择 Build Path → Configure Build Path…

在弹出的Properties for ***** 中:
Java Build Path → Libraries → JRE System Library [J2SE-1.5] ,然后点Edit… 。

在弹出的Edit Library中:
选择 Alternate JRE,选择自己本机的JDK,也可以点击 Installed JREs 安装一个。

切换完JDK后,所出现在项目结构,就是maven的结构了。可以看一下下图结构与自己建立的项目对比一下,确认没有落下的步骤。

以上就是通过Eclipse创建maven项目的方法,希望可以帮助到大家。