Eclipse Maven Jetty集成
2016-06-22 14:20
645 查看
1、添加项目
2、选择maven-archetype-webapp
3、添加公司/组织名称,项目名称,版本号
4、补全未生成的文件夹
5、pom.xml中添加jetty插件信息
[html] view
plain copy
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.9</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<stopKey>foo</stopKey>
<stopPort>9999</stopPort>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
<daemon>true</daemon>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
6、执行 mvn jett:run
[html] view
plain copy
D:\workspace201408\sshdemo>mvn jetty:run
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building sshdemo Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-jetty-plugin:6.1.9:run (default-cli) > test-compile @ sshdemo >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ sshdemo ---
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ sshdemo ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ sshdemo ---
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\workspace201408\sshdemo\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ sshdemo ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] <<< maven-jetty-plugin:6.1.9:run (default-cli) < test-compile @ sshdemo <<<
[INFO]
[INFO] --- maven-jetty-plugin:6.1.9:run (default-cli) @ sshdemo ---
[INFO] Configuring Jetty for project: sshdemo Maven Webapp
[INFO] Webapp source directory = D:\workspace201408\sshdemo\src\main\webapp
[INFO] web.xml file = D:\workspace201408\sshdemo\src\main\webapp\WEB-INF\web.xml
[INFO] Classes = D:\workspace201408\sshdemo\target\classes
[INFO] Logging to org.slf4j.impl.SimpleLogger(org.mortbay.log) via org.mortbay.log.Slf4jLog
[INFO] Context path = /sshdemo
[INFO] Tmp directory = determined at runtime
[INFO] Web defaults = org/mortbay/jetty/webapp/webdefault.xml
[INFO] Web overrides = none
[INFO] Webapp directory = D:\workspace201408\sshdemo\src\main\webapp
[INFO] Starting jetty 6.1.9 ...
[INFO] jetty-6.1.9
[INFO] No Transaction manager found - if your webapp requires one, please configure one.
[INFO] Started SelectChannelConnector@0.0.0.0:8080
[INFO] Started Jetty Server
7、访问http://localhost:8080/sshdemo/
以上过程是最简单的eclipse + jetty + maven实现一个小的web项目,当然这里jetty其实是一个轻量级的web容器,和tomcat类似。
2、选择maven-archetype-webapp
3、添加公司/组织名称,项目名称,版本号
4、补全未生成的文件夹
5、pom.xml中添加jetty插件信息
[html] view
plain copy
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.9</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<stopKey>foo</stopKey>
<stopPort>9999</stopPort>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
<daemon>true</daemon>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
6、执行 mvn jett:run
[html] view
plain copy
D:\workspace201408\sshdemo>mvn jetty:run
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building sshdemo Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-jetty-plugin:6.1.9:run (default-cli) > test-compile @ sshdemo >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ sshdemo ---
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ sshdemo ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ sshdemo ---
[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\workspace201408\sshdemo\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ sshdemo ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] <<< maven-jetty-plugin:6.1.9:run (default-cli) < test-compile @ sshdemo <<<
[INFO]
[INFO] --- maven-jetty-plugin:6.1.9:run (default-cli) @ sshdemo ---
[INFO] Configuring Jetty for project: sshdemo Maven Webapp
[INFO] Webapp source directory = D:\workspace201408\sshdemo\src\main\webapp
[INFO] web.xml file = D:\workspace201408\sshdemo\src\main\webapp\WEB-INF\web.xml
[INFO] Classes = D:\workspace201408\sshdemo\target\classes
[INFO] Logging to org.slf4j.impl.SimpleLogger(org.mortbay.log) via org.mortbay.log.Slf4jLog
[INFO] Context path = /sshdemo
[INFO] Tmp directory = determined at runtime
[INFO] Web defaults = org/mortbay/jetty/webapp/webdefault.xml
[INFO] Web overrides = none
[INFO] Webapp directory = D:\workspace201408\sshdemo\src\main\webapp
[INFO] Starting jetty 6.1.9 ...
[INFO] jetty-6.1.9
[INFO] No Transaction manager found - if your webapp requires one, please configure one.
[INFO] Started SelectChannelConnector@0.0.0.0:8080
[INFO] Started Jetty Server
7、访问http://localhost:8080/sshdemo/
以上过程是最简单的eclipse + jetty + maven实现一个小的web项目,当然这里jetty其实是一个轻量级的web容器,和tomcat类似。
相关文章推荐
- Java代码实现设置系统时间
- Java编程中“为了性能”需做的26件事
- spring mvc中的@PathVariable
- java学习笔记:final关键字 与 array
- 在Spring MVC中测试Servlet3.0异步
- 9个基于Java的搜索引擎框架
- JAVA2048小游戏
- java反射机制
- Java多线程系列--“基础篇”03之 Thread中start()和run()的区别
- Spring整合Hibernate,事务的几种传播特性,数据库事务隔离级别(脏读幻读不可重复读)
- 【Java并发编程实战】—–synchronized
- Hprose-java之异常处理
- springmvc 上传下载
- 【Java并发编程实战】-----线程基本概念
- @SuppressWarnings 批注 含义和用法
- java自定义注解和运行时靠反射机制获取注解
- java实现标准化考试系统详解(一)-----软件结构介绍
- kafka安装(一)
- Java日历时间处理解析
- java 输入的三种方法