Maven构建web项目在Eclipse中部署的几种方法
2015-06-16 14:16
399 查看
作者: Michael 日期: 2012 年
9 月 10 日发表评论 (3)查看评论
目录:
方法一:运用Maven的plugin:jetty来部署web
方法二:运用Eclipse 的Jetty插件直接部署
方法三:运用Run on Server(tomcat)部署
[方法一]、运用Maven的plugin:jetty来部署
第一步:配置POM.xml 文件
在节点<build><plugins>…</plugins></build>中配置Jetty插件依赖如下:
XHTML
第二步:配置goals参数右击项目 –> Run As –> Maven Build… –> Goals 输入:jetty:run 即可:
![](http://www.micmiu.com/wp-content/uploads/2012/09/maven-web-deploy-01.jpg)
点击Run按钮即运行日志信息如下:
打开浏览器输入:http://localhost:8080/myweb/ 即可验证web项目是否启动正常。
[方法二]、运用Eclipse 的Jetty插件直接部署
第一步:首先安装Eclipse Jetty插件
插件地址:http://code.google.com/p/run-jetty-run/
第二步:直接右击项目 –> Run As –> Run Jetty
![](http://www.micmiu.com/wp-content/uploads/2012/09/maven-web-deploy-03.jpg)
运行日志信息如下:
同样打开浏览器输入:http://localhost:8080/myweb/ 即可验证web项目是否启动正常。[方法三]、运用Run on Server(tomcat)部署第一步:转为Eclipse web项目Maven web 项目转为Eclipse web项目的基本命令:
然后把转化后的项目导入到Eclipse中
第二步:配置web项目Maven lib依赖关系
详见:http://www.micmiu.com/software/build/eclipse-maven-web-lib/
第三步:和以前web项目一样,添加到Server中运行即可
同样打开浏览器输入:http://localhost:8080/myweb/ 即可验证web项目是否启动正常。
本文介绍到此结束@Michael Sun.
原创文章,转载请注明: 转载自micmiu
– 软件开发+生活点滴[ http://www.micmiu.com/ ]
本文链接地址: http://www.micmiu.com/software/build/maven-web-eclipse-deploy/
9 月 10 日发表评论 (3)查看评论
目录:
方法一:运用Maven的plugin:jetty来部署web
方法二:运用Eclipse 的Jetty插件直接部署
方法三:运用Run on Server(tomcat)部署
[方法一]、运用Maven的plugin:jetty来部署
第一步:配置POM.xml 文件
在节点<build><plugins>…</plugins></build>中配置Jetty插件依赖如下:
XHTML
12345678 | <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> <version>6.1.26</version> <configuration> <webAppSourceDirectory>${basedir}/src/main/webapp</webAppSourceDirectory> </configuration></plugin> |
![](http://www.micmiu.com/wp-content/uploads/2012/09/maven-web-deploy-01.jpg)
点击Run按钮即运行日志信息如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building myweb Maven Webapp 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] >>> maven-jetty-plugin:6.1.26:run (default-cli) @ myweb >>> [INFO] [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ myweb --- [debug] execute contextualize [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ myweb --- [INFO] No sources to compile [INFO] [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ myweb --- [debug] execute contextualize [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory D:\workspace_sun\maven-demo\myweb\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ myweb --- [INFO] No sources to compile [INFO] [INFO] <<< maven-jetty-plugin:6.1.26:run (default-cli) @ myweb <<< [INFO] [INFO] --- maven-jetty-plugin:6.1.26:run (default-cli) @ myweb --- [INFO] Configuring Jetty for project: myweb Maven Webapp [INFO] Webapp source directory = D:\workspace_sun\maven-demo\myweb\src\main\webapp [INFO] Reload Mechanic: automatic [INFO] Classes = D:\workspace_sun\maven-demo\myweb\target\classes 2012-09-10 16:06:55.837:INFO::Logging to STDERR via org.mortbay.log.StdErrLog [INFO] Context path = /myweb [INFO] Tmp directory = determined at runtime [INFO] Web defaults = org/mortbay/jetty/webapp/webdefault.xml [INFO] Web overrides = none [INFO] web.xml file = D:\workspace_sun\maven-demo\myweb\src\main\webapp\WEB-INF\web.xml [INFO] Webapp directory = D:\workspace_sun\maven-demo\myweb\src\main\webapp [INFO] Starting jetty 6.1.26 ... 2012-09-10 16:06:55.945:INFO::jetty-6.1.26 2012-09-10 16:06:56.082:INFO::No Transaction manager found - if your webapp requires one, please configure one. [INFO] Started Jetty Server 2012-09-10 16:06:56.382:INFO::Started SelectChannelConnector@0.0.0.0:8080 |
[方法二]、运用Eclipse 的Jetty插件直接部署
第一步:首先安装Eclipse Jetty插件
插件地址:http://code.google.com/p/run-jetty-run/
第二步:直接右击项目 –> Run As –> Run Jetty
![](http://www.micmiu.com/wp-content/uploads/2012/09/maven-web-deploy-03.jpg)
运行日志信息如下:
12345678 | Running Jetty 6.1.262012-09-10 16:28:13.308:INFO::Logging to STDERR via org.mortbay.log.StdErrLogParentLoaderPriority enabledContext path:/mywebProjectClassLoader: entry=D:\workspace_sun\maven-demo\myweb\target\classesProjectClassLoader: entry=D:\.m2\repository\junit\junit\3.8.1\junit-3.8.1.jar2012-09-10 16:28:13.374:INFO::jetty-6.1.262012-09-10 16:28:13.697:INFO::Started SelectChannelConnector@0.0.0.0:8080 |
1 | mvn eclipse:eclipse -Dwtpverison=1.0 |
第二步:配置web项目Maven lib依赖关系
详见:http://www.micmiu.com/software/build/eclipse-maven-web-lib/
第三步:和以前web项目一样,添加到Server中运行即可
同样打开浏览器输入:http://localhost:8080/myweb/ 即可验证web项目是否启动正常。
本文介绍到此结束@Michael Sun.
原创文章,转载请注明: 转载自micmiu
– 软件开发+生活点滴[ http://www.micmiu.com/ ]
本文链接地址: http://www.micmiu.com/software/build/maven-web-eclipse-deploy/
相关文章推荐
- java 制作exe
- Java-马士兵设计模式学习笔记-迭代器模式-模仿Collectin ArrayList LinckedList
- java并发控制:ReentrantLock Condition使用详解
- 链表反转
- Java IO操作
- java socket简单实现
- java获取显示器屏幕大小
- hibernate4 + spring3 整合报错问题
- springmvc+shiro+freemarker实现的安全及权限管理
- 各种排序算法的分析及java实现
- LeetCode_35---Search Insert Position
- Java并发编程-12-等待多个并发事件的完成-CountDownLatch
- Java如何将Exception.printStackTrace()转换为String输出
- JNI学习总结之:java调用native函数以及native函数回调java类成员方法
- Java异常处理机制
- 邂逅Java集合框架
- (转) Spring读书笔记-----部署我的第一个Spring项目
- JAVA中Semaphore(信号量)
- Java垃圾回收机制
- java.lang.ClassNotFoundException: org.junit.Assume$AssumptionViolatedException