Maven通过命令创建web项目

通过dos命令行定位到要创建项目的目录,执行以下命令:

mvn archetype:create -DgroupId=com.learn -DartifactId=LearnNew -DarchetypeArtifactId=maven-archetype-webapp

 执行结果如下:

 

生成项目目录机构:


 
 

打开index.jsp 就能看到 <html>
<body>
<h2>Hello World!</h2>
</body>
</html> 

执行mvn install,并将target下面的LearnNew.war放于tomcat的webapps下面,启动tomcat,通过浏览器访问:http://localhost:8080/LearnNew/

将会看到熟悉的:”Hello World!“

猜你喜欢

转载自longfor5.iteye.com/blog/2079688