【原】maven web项目eclipse搭建
2014-09-19 19:14
387 查看
1、new->other->Maven Project,点击next
2、继续next
3、选择maven-archetype-webapp,如果找不到可以再Filter里面搜索web,就可以找到了。继续next
4、输入自己定义的名称,如下:
5、之后再项目名称上面右击->Build Path->add Library->选择Server Runtime,next
6、选中Apach Tomcat v7.0(你的版本可能是6或者8),Finish
7、要建立maven结构,需要修改在项目里手动添加文件夹:
src\main\java
src\main\resources
src\test\java
src\test\resources
8、修改项目下面的classpath,类似下面配置:
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/main/resources"/>
<classpathentry kind="src" path="src/test/java"/>
<classpathentry kind="src" path="src/test/resources"/>
eclipse生成的classpath中:
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
9、在项目名称上右击->reFresh,就可以了
10、将tomcat端口改为80。
11、将项目部署到tomcat上,运行tomcat,浏览器输入“localhost/项目名”,就可以访问了
2、继续next
3、选择maven-archetype-webapp,如果找不到可以再Filter里面搜索web,就可以找到了。继续next
4、输入自己定义的名称,如下:
5、之后再项目名称上面右击->Build Path->add Library->选择Server Runtime,next
6、选中Apach Tomcat v7.0(你的版本可能是6或者8),Finish
7、要建立maven结构,需要修改在项目里手动添加文件夹:
src\main\java
src\main\resources
src\test\java
src\test\resources
8、修改项目下面的classpath,类似下面配置:
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/main/resources"/>
<classpathentry kind="src" path="src/test/java"/>
<classpathentry kind="src" path="src/test/resources"/>
eclipse生成的classpath中:
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
9、在项目名称上右击->reFresh,就可以了
10、将tomcat端口改为80。
11、将项目部署到tomcat上,运行tomcat,浏览器输入“localhost/项目名”,就可以访问了
相关文章推荐
- 使用Maven在Eclipse搭建Web项目 有项目实例 绝对好用
- eclipse下搭建maven web项目
- Maven Web+SSH 项目搭建(Eclipse)
- eclipse上搭建maven多模块Java Web项目
- 【web开发】Eclipse中SpringMVC+Mybatis+Maven搭建的项目框架(SMM框架)
- J2ee项目从0搭建(三):eclipse中用Maven创建Web项目
- j2ee 简单网站搭建:(一) windows 操作系统下使用 eclipse 建立 maven web 项目
- Eclipse搭建Maven形式的web项目
- maven eclipse搭建web项目并发布到tomcat
- eclipse+maven搭建web项目
- eclipse搭建maven的web项目
- ECLIPSE 搭建MAVEN web项目
- 在eclipse中用Maven搭建Web项目
- 在eclipse中maven web项目搭建
- Eclipse 搭建 Maven Web项目
- eclipse搭建maven项目(前提:已经有Web项目的环境的前提下)
- eclipse使用maven搭建web项目
- Eclipse使用Maven搭建Web项目
- eclipse使用maven搭建web项目
- eclipse上搭建maven多模块Java Web项目