• (转)利用eclipse external tool 执行mvn jetty:run


    一、如果这个工程是标准的maven-webapp那么基本上不用修改,直接运行jetty:run就可以执行。

     

    但是有时候会报错说

     

    [ERROR] No plugin found for prefix 'jetty' in the current project and in the plu
    gin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repo
    sitories [local (C:Documents and Settings eymont.li.m2 epository), central (
    http://repo.maven.apache.org/maven2)] -> [Help 1]

     

    在pom.xml的project.build节点下添加 

     

    <plugins>
     <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>maven-jetty-plugin</artifactId>
            <version>6.1.10</version>
            
      </plugin>
      </plugins>

     

     

     

     

     

     

     

    In order to run Jetty on a webapp project which is structured according to the usual Maven defaults (resources in ${basedir}/src/main/webapp, classes in${project.build.outputDirectory} and the web.xml descriptor at ${basedir}/src/main/webapp/WEB-INF/web.xml, you don't need to configure anything.

    Simply type:

    mvn jetty:run

    This will start Jetty running on port 8080 and serving your project. Jetty will continue to run until the plugin is explicitly stopped, for example, by a <cntrl-c>.

    二、本来一直用jetty插件,换了Ubuntu后,在eclipse里装jetty插件总失败,就想放弃使用插件。

    反正maven里已经配置好了jetty,用mvn jetty:run也能启动jetty服务,但是这样就不能用eclipse断点调试,比较不方便。上网调查了下,发现可以用eclipse external tool调用maven命令来执行mvn jetty:run,并能使用debug模式。于是写此文章,以做备忘。

    1. Run -> External Tools -> External Tools Configurations

    配置见下图

    上图的工作路径是在front下,但是项目要求maven执行的时候在工程根目录下,可以用下图配置



    切到Environment标签,增加如下变量

    Name:MAVEN_OPTS

    Value:-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8443,server=y,suspend=y


    然后保存。


    2 Run -> Debug Configurations

    注意此处的端口号要和上面的一致。


    保存,成功!

  • 相关阅读:
    [CSP校内集训]2019.10.16数学专题
    Knights of the Round Table(缩点+判奇环) poj 2942 && 洛谷SP2878
    机房测试7:exam(二进制+模拟)
    机房测试9:gift(单调队列优化dp)
    机房测试9:hotel(神奇dp)
    机房测试8:question(求最大1矩阵:悬线法 or 二分)
    机房测试7:paint(分治+st表)
    机房测试6:矿石(优先队列)
    机房测试6:括号序列(hash+栈 )
    bzoj1123 && 洛谷 P3469 tarjan割点的运用
  • 原文地址:https://www.cnblogs.com/gmq-sh/p/4271916.html
Copyright © 2020-2023  润新知