一、如果这个工程是标准的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 self与static的区别

    self vs static 用一个demo来直接说明self与static的区别.self示例: <?phpclass Vehicle {    protected static $name ...

  2. mysql Table 'performance_schema.session_variables' doesn't exist

    CMD  进入MYSQL的安装目录..Bin 下 执行 mysql_upgrade -u root -p --force 输入密码..然后等待一会儿..会跑一些东西..然后重启服务

  3. .net3.5后新增的 BeginInvoke EndInvoke 异步操作

    protected void Main() { //首先定义一个方法的封装..后边的LongTimeMethod是被封装的方法.. Func<int> longTimeAction = n ...

  4. Linux下,telnet命令如何退出

    测试连接本地的memcached telnet 链接后是这样的: wangkongming@Vostro ~ $ telnet Trying 127.0.0.1... Connected to 127 ...

  5. Java字节流:InputStream OutputStream

    字节输入流:InputStream 类声明: public abstract class InputStream implements Closeable 位于java.io包下,是一个抽象类. 官方 ...

  6. Properties类的使用方法

    它提供了几个主要的方法: 1. getProperty ( String key),用指定的键在此属性列表中搜索属性.也就是通过参数 key ,得到 key 所对应的 value. 2. load ( ...

  7. flask 知识点总结

    ============================request对象的常用属性============================具体使用方法如下:request.headers, requ ...

  8. Android手机同步电脑端google chrome书签

    我先声明:文中FQ 都是博客园自动将中文(fan qiang)转换为FQ的,并不是我本来写的就是FQ~~ 手机和电脑都必须要能登录google(Xee:几乎所有做开发的人都每天的生活都离不开谷歌了,可 ...

  9. Java-Linux系统中搭建开发环境

    准备工作: 0.虚拟机中的系统→{RHEL-I386} 1.JDK→{首先要知道下载哪个版本" [zf@string ~]$ getconf LONG_BIT ":".t ...

  10. Ansible简明使用手册

            Ansible使用简明手册 1.简介 ansible是新出现的自动化运维工具,基于Python开发,集合了众多运维工具(puppet.cfengine.chef.func.fabric ...