zoukankan      html  css  js  c++  java
  • (转)利用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

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


    保存,成功!

  • 相关阅读:
    BOM
    no response from Graphic Screen Painter Exiting
    Windows Mobile 中模拟按键
    C# 获取汉字拼音首字母
    Web Service介绍
    .net/c#中栈和堆的区别及代码在栈和堆中的执行流程详解
    使用JSON加速AJAX(By Sean Kelly)
    Sql字符串操作函数
    一个简单AJAX注册示例
    .Net平台开发的技术规范与实践精华总结
  • 原文地址:https://www.cnblogs.com/gmq-sh/p/4271916.html
Copyright © 2011-2022 走看看