When are developed using maven and git environmental development environment, then how will we beginner's project successfully imported into eclipse, and successfully run it? ? ? The following tutorial can tell you -
(Ps: The second step may be the problem you encountered please look carefully - the project becomes a Dynamic Web Project)
Eclipse 1 Git introduced many of maven project (project maven introduced Git embodiment can feed in eclipse
Line, or use git commands can also be ---)
①: The first method: View this article on the method, operating with git command breaks
http://blog.csdn.net/baidu_31657889/article/details/52117753
②: The second method:
(1) The first is to pull code.
In Eclipse, which has a Git Repositories Exploring. Is Git repository, clone a git repository. Copy a git repository, enter the address and press next, follow the instructions that have been next to it.
Branch selection preproduction pull Code Process
After the code pull down Remember where you store the code.
(2) import maven project.
So quickly import a maven project? Oh, that's right. It is to import maven project.
Eclipse can press File-> Import-> Existing Maven projects-> next. Select where you just put code.
Which in the choice of the project, select Existing Maven Projects
Select the project folder where (my git project folder: C: \ Users \ lpshou.liu \ git \ ba-csc)
Point to finish
Here below you will automatically check whether there is change directory pom.xml. Select the item you want to import, but press Finish.
I're importing B3log project, because the project structure B3log of maven project is more complex. Suitable for explaining to do.
(3) Delete maven project.
上一步我们导入了maven项目。可是,这个项目并不能用于git。也就是说不能跟本地的git仓库对比,提交等操作。
所以,我们在我们的项目上面全部选择后,右键,删除项目
(注意不选择Delete project contents on disk(cannot be undone),也就不是真正删除文件)
(4) 导入git项目。
上一步我们删除了我们的maven项目。这时,打开我们的Git仓库
里面有一个文件夹Working Dirctory。这时我们项目路径。或者打开里面的子项目,在上面,右键Import Project。选择第一个Import existing project->next->finish。
好了,这样子就打开了一个放在Github上面的maven项目了。
③:第三种方法:
1)File->import->Git->project from git
输入git地址,之后next
选择正确分支,然后next,然后import as general project 然后finish
(2)右键项目,然后选择Existing Maven Project
之后 next ->finish即可
2 把项目变成Dynamic Web项目
(1) 右键项目,选择Project Facets,点击Convert to faceted from
(2) 配置Project Facets
更改Dynamic Web Module的Version为2.4。(3.0为Java7的)。
如果提示错误,可能需要在Java Compiler设置Compiler compliance level 为1.6。或者需要在此窗口的Java的Version改成1.6。
(3) 配置 Modify Faceted Project
点击Further configuration available…,弹出Modify Faceted Project窗口
此处是设置web.xml文件的路径,我们输入src/main/webapp。
Generate web.xml deployment descriptor自动生成web.xml文件,可选可不选。
(4) 设置部署程序集(Web Deployment Assembly)
上面步骤设置完成后,点击OK,Properties窗口会关 闭,在右键项目打开此窗口。在左侧列表中会出现一个Deployment Assembly,点击进去后,如下图:
此处列表是,部署项目时,文件发布的路径。
1,我们删除test项,因为test是测试使用,并不需要部署。
2,设置将Maven的jar包发布到lib下。
Add -> Java Build Path Entries -> Maven Dependencies -> Finish
3,Add->Project->选中ba-csc-api和ba-csc-biz ->Finish
设置完成效果图
3 利用Tomcat发布
(1)新建一个server
(2)在server上配置项目
(3)启动server 输入:localhost:8080/项目名称/页面 即可访问
本文链接:https://blog.csdn.net/baidu_31657889/article/details/52117740