场景1:在cmd命令行窗口通过maven命令启动web项目,然后通过本机eclipse远程debug调试项目。

场景2:在远程机器cmd命令行窗口通过maven命令启动web项目,然后想通过本机eclipse远程debug调试项目。


第一步:通过cmd命令行进入项目根目录:然后输入命令:mvnDebug Tomcat7:run -Pmysql

(注意:-Pmysql是需要激活我的项目下指定的profile,根据自己项目实际情况选择是否需要输入-P选项参数)

操作如下图:


mvnDebug是maven下的调试运行命令,通过去maven安装目录下的bin目录可查看此命令行脚本文件,

如下图:



打开脚本文件查看调试端口号为8000



执行命令后可看到如下提示: 监听8000端口。此时项目已经运行,并开启了远程调试功能。



第二步  :  配置eclipse远程调试连接。

 通过右击项目pom.xml文件->选择Debug As->选择Debug Configurations...,进入项目配置界面:


选中Remote Java Application 然后选中左上角的新建图标,新建一个Remote Java Application配置

然后在Connect配置标签页依次填入配置名称,远程调试的项目,项目运行主机地址host 以及远程调试端口(就是第一步mavenDebug调试运行监听的端口8000

进入source标签配置页,将项目源码加进来,如下图所示:



之后点击Apply->Debug 即可进行远程调试项目。


第三步:最后在项目中需要断点调试的地方,加入断点,即可进行远程Debug调试。

效果如下图所示:









GitHub 加速计划 / ma / maven
36
2
下载
Maven: Apache Maven是一个开源的项目管理和构建工具,主要用于Java项目。适合需要自动化项目构建和依赖管理的开发者。特点包括约定优于配置、易于使用和社区驱动。
最近提交(Master分支:2 个月前 )
0aaf13d9 Bumps [actions/cache](https://github.com/actions/cache) from 4.3.0 to 5.0.0. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/0057852bfaa89a56745cba8c7296529d2fc39830...a7833574556fa59680c1b7cb190c1735db73ebf0) --- updated-dependencies: - dependency-name: actions/cache dependency-version: 5.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 2 天前
2ece5e0f Bumps [ch.qos.logback:logback-classic](https://github.com/qos-ch/logback) from 1.5.21 to 1.5.22. - [Release notes](https://github.com/qos-ch/logback/releases) - [Commits](https://github.com/qos-ch/logback/compare/v_1.5.21...v_1.5.22) --- updated-dependencies: - dependency-name: ch.qos.logback:logback-classic dependency-version: 1.5.22 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 2 天前
Logo

AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。

更多推荐