How to create Maven project in eclipse jee and convert it to Dynamic web project
Note: This document is only for the following eclipse versions, as shown in the figure
For convenience, I put my local compressed package in the micro cloud network disk, you can download it directly, jee, subversion, m2eclipse are all integrated, download address
Link: http://pan.baidu.com/s/1i3pDNd7
1. Create a maven project
- Select File->New->Other->Maven->Maven Project in the menu bar of eclipse
- After the next step, select Create a simple project (skip archetype selection), as shown in the figure
- After the next step, enter Group Id, Archive Id, Packaging and click Finish, as shown in the figure
- After the successful creation of the file directory, as shown in the figure
2. Dynamic Web Project converted to java
- Right-click on the Project name and select Properties
- Select Project Facets->Convert to Faceted from..., as shown in the figure
- Select Dynamic Web Module, Version is 2.5 (I haven't tested whether it is feasible for version 3.0), select Java, Version is 1.6, and click Further configuration available... as shown in the figure
- Modify the Content directory to /src/main/webapp/, click OK, as shown in the figure
- Finally, click OK of Properties for showcase to complete the conversion, and the final directory structure is as shown in the figure
3. Modify the Java Build Path
- Right-click on the Project name and select Properties
- Select Java Build Path, remove JRE 1.5 version, and then click Add Library, as shown in the figure
- Select JRE System Library, click Next, as shown in the figure
- 选择你设置的jdk6版本,点击Finish,如图
- 最后点击OK,完成设置,如图
四.修改Java Compile
五.修改Deployment Assembly
- 右键点击Project的名称,选择Properties
- 选择Deployment Assembly,并点击Add,如图
- 选择Java Build Path Entries,点击Next,如图
- 选择Maven Dependencies,点击Finish,如图
- 最好点击OK,完成设置,如图
六.设置Server Apache Tomcat
- 菜单栏选择Window->Show View->Servers
- 点击new server wizard,如图
- 选择Tomcat v6.0 Server,点击Next,如图
- 选择Browse,选择正确的Apache Tomcat的安装目录,然后点击Next,如图
- 选择要部署的项目如showcase,然后点击Add,点击Finish,如图
注意:
在Add and Remove的时候提示这个:Tomcat version 6.0 only supports J2EE 1.2, 1.3, 1.4, and Java EE 5 Web modules
- 完成设置后的项目如图
- 在Servers View上双击Tomat v6.0 Server at localhost[Stopped Republish],如图
- 修改项目的部署目录为Tomcat installtion目录,如图
- 修改项目的访问路径,即去掉比如http://localhost/showcase/目录中的showcase,如图
- 关掉Auto reloading enabled,这样不用每次修改文件就自动部署,如图
- Right-click Tocmat v6.0 Server at localhost[Stopped Republish], click Clean to complete the deployment of the web project, as shown in the figure
- Finally, the deployment in the Tomcat directory was successful, as shown in the figure
7. Run the project in Apache Tomcat