IntelliJ IDEA调试器在停止时不会终止进程。

huangapple go评论67阅读模式
英文:

IntelliJ IDEA Debugger doesn't terminate the process when Stopped

问题

以下是翻译好的内容:

我正在尝试使用 Maven 调试我构建的 REST API,但无论何时我停止调试器,它都会显示一条消息:

与目标虚拟机断开连接,地址:'127.0.0.1:50047',传输:'socket'

而远程进程似乎仍在运行:

IntelliJ IDEA调试器在停止时不会终止进程。

是否有办法修复这个问题,使得当我停止调试器时,进程也停止运行?

这是我的 POM.xml 文件:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>jetbrains</groupId>
    <artifactId>ProductProject</artifactId>
    <version>1.0</version>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.3.RELEASE</version>
    </parent>

    <repositories>
        <repository>
            <id>spring-releases</id>
            <url>https://repo.spring.io/libs-release</url>
        </repository>
    </repositories>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>8</source>
                    <target>8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-autoconfigure</artifactId>
            <version>2.3.3.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot</artifactId>
            <version>2.3.3.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.12</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>5.2.8.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
    </dependencies>

</project>

运行配置中在命令行字段中有 spring-boot:run,工作目录是我的项目文件夹。

英文:

I am trying to debug the REST API I have built using maven, however, whenever I stop the debugger, it shows a message:

Disconnected from the target VM, address: &#39;127.0.0.1:50047&#39;, transport: &#39;socket&#39;

And the remote process still seems to be running:

IntelliJ IDEA调试器在停止时不会终止进程。

Is there a way to fix it so that when I stop the debugger, the process also stops running?

here is my POM.xml file:

    &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot;
xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
&lt;groupId&gt;jetbrains&lt;/groupId&gt;
&lt;artifactId&gt;ProductProject&lt;/artifactId&gt;
&lt;version&gt;1.0&lt;/version&gt;
&lt;parent&gt;
&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
&lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
&lt;version&gt;2.3.3.RELEASE&lt;/version&gt;
&lt;/parent&gt;
&lt;repositories&gt;
&lt;repository&gt;
&lt;id&gt;spring-releases&lt;/id&gt;
&lt;url&gt;https://repo.spring.io/libs-release&lt;/url&gt;
&lt;/repository&gt;
&lt;/repositories&gt;
&lt;build&gt;
&lt;plugins&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
&lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
&lt;configuration&gt;
&lt;source&gt;8&lt;/source&gt;
&lt;target&gt;8&lt;/target&gt;
&lt;/configuration&gt;
&lt;/plugin&gt;
&lt;/plugins&gt;
&lt;/build&gt;
&lt;dependencies&gt;
&lt;dependency&gt;
&lt;groupId&gt;junit&lt;/groupId&gt;
&lt;artifactId&gt;junit&lt;/artifactId&gt;
&lt;version&gt;4.12&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
&lt;artifactId&gt;spring-boot-autoconfigure&lt;/artifactId&gt;
&lt;version&gt;2.3.3.RELEASE&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
&lt;artifactId&gt;spring-boot&lt;/artifactId&gt;
&lt;version&gt;2.3.3.RELEASE&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.projectlombok&lt;/groupId&gt;
&lt;artifactId&gt;lombok&lt;/artifactId&gt;
&lt;version&gt;1.18.12&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.springframework&lt;/groupId&gt;
&lt;artifactId&gt;spring-web&lt;/artifactId&gt;
&lt;version&gt;5.2.8.RELEASE&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
&lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
&lt;/dependency&gt;
&lt;/dependencies&gt;
&lt;/project&gt;

run configuration has spring-boot:run in the command line field and working directory is my project folder

答案1

得分: 2

启用“立即终止调试进程”选项位于“设置(首选项)| 构建、执行、部署 | 调试器”中。

IntelliJ IDEA调试器在停止时不会终止进程。

英文:

Enable "Kill the debug process immediately" option in "Settings (Preferences)| Build, Execution, Deployment | Debugger"

IntelliJ IDEA调试器在停止时不会终止进程。

答案2

得分: 2

已解决:在POM.xml中为spring-boot-maven-plugin添加&lt;version&gt; 1.2.7.RELEASE &lt;/version&gt;似乎已经修复了这个问题。阅读到这与分叉有关。

英文:

SOLVED: Adding &lt;version&gt; 1.2.7.RELEASE &lt;/version&gt; to the spring-boot-maven-plugin in the POM.xml seems to have fixed the issue. Read that it was something to do with forking.

huangapple
  • 本文由 发表于 2020年9月2日 18:15:38
  • 转载请务必保留本文链接:https://go.coder-hub.com/63703425.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定