Apache Maven Web 应用


当前第2页 返回上一页

打开 C:\ > MVN > trucks > src > main > webapp > 文件夹, 你将看到 index.jsp.

<html>
   <body>
      <h2>Hello World!</h2>
   </body>
</html>

Build Web Application

打开终端,进入 C:\MVN\trucks 目录,然后执行如下 mvn 命令.

C:\MVN\trucks>mvn clean package

Maven 将会开始构建此工程,日志输出如下:

[INFO] Scanning for projects...
[INFO] -------------------------------------------------------------------
[INFO] Building trucks Maven Webapp
[INFO]    task-segment: [clean, package]
[INFO] -------------------------------------------------------------------
[INFO] [clean:clean {execution: default-clean}]
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (Cp1252 actually) to 
copy filtered resources,i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] [compiler:compile {execution: default-compile}]
[INFO] No sources to compile
[INFO] [resources:testResources {execution: default-testResources}]
[WARNING] Using platform encoding (Cp1252 actually) to 
copy filtered resources,i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory 
C:\MVN\trucks\src\test\resources
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] No sources to compile
[INFO] [surefire:test {execution: default-test}]
[INFO] No tests to run.
[INFO] [war:war {execution: default-war}]
[INFO] Packaging webapp
[INFO] Assembling webapp[trucks] in [C:\MVN\trucks\target\trucks]
[INFO] Processing war project
[INFO] Copying webapp resources[C:\MVN\trucks\src\main\webapp]
[INFO] Webapp assembled in[77 msecs]
[INFO] Building war: C:\MVN\trucks\target\trucks.war
[INFO] -------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] -------------------------------------------------------------------
[INFO] Total time: 3 seconds
[INFO] Finished at: Tue Jul 17 11:22:45 IST 2012
[INFO] Final Memory: 11M/85M
[INFO] -------------------------------------------------------------------

部署 Web 应用

现在拷贝在 C:\ > MVN > trucks > target > 文件夹下的 trucks.war 到你的 web 服务器的 webapp 目录下,并且重启 web 服务。

测试 Web 应用

使用 URL: http://\<server-name>:\<port-number>/trucks/index.jsp 来运行你的 Web 应用。

验证输出结果:


标签:Maven

返回前面的内容

相关阅读 >>

apache maven elipse ide

apache maven 概述

apache maven 构建生命周期

apache maven 构建配置文件

apache maven 工程模版

apache maven netbeans

apache maven pom

spring boot多module项目导入eclipse

apache maven web 应用

apache maven 构建 &amp; 测试工程

更多相关阅读请进入《maven》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...