zoukankan      html  css  js  c++  java
  • 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。

  • 相关阅读:
    navicat设置唯一
    H5图片防盗链处理
    jar包更新
    微信小程序开发工具“当前系统代理不是安全代理”
    Set和Map
    OSS先后上传相同地址的图片
    js遍历删除数组中不符合条件的元素
    SSL配置
    关于socket.io获取客户端真实IP地址
    请在微信客户端打开链接 html
  • 原文地址:https://www.cnblogs.com/xiashiwendao/p/8688475.html
Copyright © 2011-2022 走看看