一、如果这个工程是标准的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\reymont.li\.m2\repository), 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

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

保存,成功!

(转)利用eclipse external tool 执行mvn jetty:run的更多相关文章

  1. Command mvn jetty:run

    How to use the command mav jetty:run? There is a simple display as below: Step 1: You should generat ...

  2. spring3-mvc-maven-hello-world-master mvn jetty:run 及 mvn war:war 指令

    spring3-mvc-maven-annotation-hello-world-master  mvn jetty:run Run this project locally Terminal $ m ...

  3. mvn jetty:run 出现PermGen space outofmemeryerror

    使用mvn jetty:run跑别人的项目时出现了PermGen space outofmemeryerror异常 http://stackoverflow.com/questions/1451648 ...

  4. Eclipse External Tool Configration Notepad++

    Location: C:\Program Files\Notepad++\notepad++.exe Arguments: ${resource_loc}

  5. Eclipse中使用Maven的Jetty插件Debug Web项目

    1.环境配置 JAVA_HOME=D:\Program Files\Java\jdk1.7.0_80 JRE_HOME=%JAVA_HOME%\jre CLASSPATH=.;%JAVA_HOME%/ ...

  6. 命令行执行 mvn package 和常见mvn命令

    cmd 打开命令提示符, 然后打开代码所在目录,例如 d: cd d:/code 执行 mvn package Maven常用命令:  1. 创建Maven的普通java项目:     mvn arc ...

  7. mvn jetty debug

    使用mvn jetty:run很爽吧,但是怎么debug了,找了Google的N多老外文章,终于可以了,文章链接:http://gaertig.pl/blog/en/2009/03/debug-jet ...

  8. Mvn+Jetty启动项目

    这里要注意,Mvn加jetty启动项目,主要用到的是Maven的jetty插件,和你下的Jetty服务器没什么关系. 我的运行环境是jdk1.7,Eclipse-mars,Maven是Eclipse自 ...

  9. eclipse中报错:Errors running builder “Integrated External Tool Builder” on project

    在eclipse构建项目的时候,一直报如下错误: Errors during build. Errors running builder "Integrated External Tool ...

随机推荐

  1. php引入lucene方法

    在引入Lucene之前,先说下PHP JAVA Bridge的概念: PHP JAVA Bridge:就是在PHP和Java之间搭建一座桥梁,利用这座桥梁在这两个实体之间建立起一个沟通渠道,在这座桥梁 ...

  2. jQuery/js 正则收集(邮件验证、)

    var reg = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/; //验证邮箱的正则表达式if( ...

  3. CentOS7 mono环境连接WCF

    总结下在mono环境中使用Wcf出现的问题以帮助你快速解决问题. 1.昨天在内网Centos7下部署由Windows上开发完成的ASP.NET Mvc4项目,部署到mono环境下遇到了无法找到endp ...

  4. Java使用Jetty实现嵌入式Web服务器及Servlet容器

     Jetty是一个Java实现的开源的servlet容器,它既可以像Tomcat一样作为一个完整的Web服务器和Servlet容器,同时也可以嵌入在Java应用程序中,在Java程序中调用Jetty. ...

  5. [asp.net core]project.json(2)

    摘要 上篇文章介绍了project.json中的一部分属性.属性真的比较多,所以分开了,考虑到其中的英文比较简单,也不再进行翻译了,从英文原文中,直接粘贴过来了. project.json(1) pr ...

  6. 自定义MapReduce的类型

    package org.apache.hadoop.mapreduce.io; import java.io.DataInput; import java.io.DataOutput; import ...

  7. alter和alert防错?

    在js中这个错误经常容易犯, 那就是 alter 和 alert这两个单词经常写错. 导致js出错, 而不执行! 注意: 在js脚本中, 是 alert 弹出提示框, 而不是 alter ,js中没有 ...

  8. R 语言程序设计

    Data The zip file containing the data can be downloaded here: specdata.zip [2.4MB] The zip file cont ...

  9. linux下查找包含BOM头的文件和清除BOM头命令

    查找包含BOM头的文件,命令如下:   grep -r -I -l $'^\xEF\xBB\xBF' ./   这条命令会查找当前目录及子目录下所有包含BOM头的文件,并把文件名在屏幕上输出.   但 ...

  10. R中的name命名系列函数总结

    本文原创,转载请注明出处,本人Q1273314690 R中关于给行列赋名称的函数有 dimnames,names,rowname,colname,row.names 这五个函数,初学的时候往往分不清楚 ...