一. 在jetty上远程部署并调试maven工程

1. 下载、安装jetty

http://blog.csdn.net/guoyankun/article/details/38319689

2. 使用cargo完成远程部署

2.1. 在jetty中部署cargo-jetty-7-and-onwards-deployer

2.1.1.下载cargo-jetty-7-and-onwards-deployercargo-jetty-7-and-onwards-deployer-1.4.13-2.war

2.1.2. 修改cargo-jetty-7-and-onwards-deployer

参考:http://cargo.codehaus.org/Jetty+Remote+Deployer?print=1

注:依靠web.xml中<login-config><realm-name>指定的名字在jetty-web.xml中查找realm,参考http://www.tuicool.com/articles/ryiA3y

2.1.3 部署cargo-jetty-7-and-onwards-deployer到$(jetty.home)/webapps/cargo-jetty-deployer

2.2. 在maven工程中添加remote deploy的支持

同样参考http://cargo.codehaus.org/Jetty+Remote+Deployer?print=1,但要注意一下几点

2.2.1. 需要在$(home)/.m2/settings.xml中添加一条pluginGroup进pluginGroups,否则下载不到该plugin

    <pluginGroups>
        <pluginGroup>org.codehaus.cargo</pluginGroup>
    </pluginGroups>

2.2.2. maven工程的pom.xml,build参考如下配置

<build>

<plugins>

<plugin>

<groupId>org.codehaus.cargo</groupId>

<artifactId>cargo-maven2-plugin</artifactId>

<version>1.4.9</version>

<configuration>

<container>

<containerId>jetty9x</containerId>

<type>remote</type>

</container>


<configuration>

<type>runtime</type>

<properties>

<cargo.hostname>xxx.xxx.xxx.xxx</cargo.hostname>

<cargo.servlet.port>8080</cargo.servlet.port>

<cargo.remote.username>manager</cargo.remote.username>

<cargo.remote.password>manager</cargo.remote.password>

</properties>

</configuration>


<deployer>

<type>remote</type>

</deployer>


<deployables>

<deployable>

<groupId>com.2109.kitchen</groupId>

<artifactId>mobilegw</artifactId>

<type>war</type>

<properties>

<context>/mobilegw</context>

</properties>

</deployable>

</deployables>

</configuration>

</plugin>

</plugins>

</build>

2.2.3. mvn cargo:deploy过程中由于超时间隔过小,容易造成deploy不成功的情况,修改超时间隔在${jetty.home}/start.d/http.ini中。

2.2.4. mvn cargo:redeploy用于重新部署,他会删除老的,部署新的

3. 为jetty开启远程调试

java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 -Xnoagent -jar start.jar &

4. eclipse上远程调试工程

Debug Configurations => Remote Java Application => New:修改host和port指向jetty开启的调试地址(上例中端口为8000)


以上为远程部署,远程调试jetty容器下运行的java app的全过程

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值