Jetty小计,比之tomcat调试还是不方便

  不需要额外的工程支持,不需要硬盘中有tomcat之类的额外文件
  Jetty的Debug:右键Debug as... Maven Builder

  Jetty相关的配置文件如下:

 1 <profiles>
 2   <profile>
 3     <id>frontend</id>
 4     <build>
 5       <plugins>
 6         <plugin>
 7           <groupId>org.eclipse.jetty</groupId>
 8           <artifactId>jetty-maven-plugin</artifactId>
 9           <configuration>
10             <httpConnector>
11               <port>8081</port>
12             </httpConnector>
13             <systemProperties>
14               <systemProperty>
15                 <name>zipkin.service</name>
16                 <value>frontend</value>
17               </systemProperty>
18             </systemProperties>
19           </configuration>
20         </plugin>
21       </plugins>
22     </build>
23   </profile>
24   <profile>
25     <id>backend</id>
26     <build>
27       <plugins>
28         <plugin>
29           <groupId>org.eclipse.jetty</groupId>
30           <artifactId>jetty-maven-plugin</artifactId>
31           <configuration>
32             <httpConnector>
33               <port>9000</port>
34             </httpConnector>
35             <systemProperties>
36               <systemProperty>
37                 <name>zipkin.service</name>
38                 <value>backend</value>
39               </systemProperty>
40             </systemProperties>
41           </configuration>
42         </plugin>
43       </plugins>
44     </build>
45   </profile>
46 </profiles>

 

  Jetty调试的时候,发现第三方的jar包跟不进去(即使下载了源码)。需要在debug 配置里面的Enviroment添加一下内容;

1 KEY: MAVEN_OPTS; 
2 VALUE:runjdwp:transport=dt_socket,server=y,suspend=n,address=1066

  然后在source的tab下面添加一个External Archived文件即可(下面就是添加的source.jar):

 

  到此处,Jetty虽然小巧,但是其实debug调试等还是很不方便;比如大量的因为第三方包,即使有了源码也是要通过添加方式来添加之后才能够进去;但是如果tomcat则不需要;所以如果发布了一小程序,想要让用户迅速启用,那么Jetty是一个非常不错的选择;但是如果是想要开发,调试,那么还是tomcat。

posted on 2018-04-01 21:40  下士闻道  阅读(189)  评论(0编辑  收藏  举报

导航