【转】将eclipse中的dynamic web project转为Maven project

本文详细介绍了如何在Eclipse环境中使用Maven创建Web应用程序。从创建项目到部署应用,步骤清晰,包括解决常见错误的方法。适用于初学者快速上手。

Step-1

Create a simple maven Project in Eclipse.

Create Simple Maven Project in Eclipse

Step-2

Select default Workspace location

Use Default Workspace Location

Step-3

Select the maven archetype as: maven-archetype-webapp and click on next.

Select maven-archetype-webapp

Step-4

Fill out below details and click Finish. This step creates Maven Project in your EclipseEnvironment.

Create Crunchify Maven Project in Eclipse

Step-5

If you see error “The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path index.jsp /CrunchifyMavenTutorial/src/main/webapp” then add below maven dependency.

<dependency>

<groupId>javax.servlet</groupId>

<artifactId>javax.servlet-api</artifactId>

<version>3.1.0</version>

</dependency>

OR add Apache Tomcat to your Targeted Runtimes.

HTTPServlet Error? Add Target Runtime

Targeted Runtime - Apache Tomcat

Step-6

Your Maven Project should look like this.

CrunchifyMavenTutorial Eclipse Structure

Step-7

Now build project with “Maven Clean Install” to check there isn’t any dependency issue with project. Crunchify - Maven-RunAs-MavenBuild...

Maven Clean Install in Eclipse

Maven Build Successmessage in Eclipse Console

Step-8

Deploy Application on Apache Tomcat Server.

Steps:

  • Right click on Server -> Add and Remove -> Select CrunchifyMavenTutorial -> Click Finish.
  • Start tomcat server.

Step-9

Visit http://localhost:8080/CrunchifyMavenTutorial/index.jsp to see your result.

CrunchifyMavenTutorial Web Result

And you are all set.

转载于:https://my.oschina.net/swanf/blog/3075804

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值