本文介绍了本地调试应用程序在tomcat上启动,货物在IntelliJ中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的货物配置中启用调试。我正在使用具有以下配置的cargo-maven2-plugin版本1.4.19。

I am trying to enable debugging in my cargo configuration. I'm using cargo-maven2-plugin version 1.4.19 with the following configuration.

<plugins>
  <plugin>
    <groupId>org.codehaus.cargo</groupId>
    <artifactId>cargo-maven2-plugin</artifactId>
    <version>1.4.19</version>
    <configuration>
      <container>
        <containerId>tomcat8x</containerId>
      </container>
      <configuration>
        <type>standalone</type>
        <properties>
        <cargo.servlet.port>8080</cargo.servlet.port>
        <cargo.jvmargs>
          -Xmx2048m
          -Xms512m
          -Xdebug
          -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=63342
          -Xnoagent
          -Djava.compiler=NONE
        </cargo.jvmargs>
      </properties>
    </configuration>
    <deployer>
    </deployer>
    <deployables>
      <deployable type="war" file="target/spa.war"></deployable>
      </deployables>
    </configuration>
  </plugin>

应用程序使用此配置启动,但IntelliJ从不连接到JVM以启用debuging。如何使IntelliJ连接到JVM?

The application launches with this configuration but IntelliJ never connects to the JVM to enable debuging. How can I make IntelliJ connect to the JVM?

推荐答案

我修复了这个。

<plugins>
  <plugin>
    <groupId>org.codehaus.cargo</groupId>
    <artifactId>cargo-maven2-plugin</artifactId>
    <version>1.4.19</version>
    <configuration>
      <container>
        <containerId>tomcat8x</containerId>
      </container>
      <configuration>
        <type>standalone</type>
        <properties>
        <cargo.servlet.port>8080</cargo.servlet.port>
        <cargo.jvmargs>
          -Xmx2048m
          -Xms512m
          -Xdebug
          -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9009
          -Xnoagent
          -Djava.compiler=NONE
        </cargo.jvmargs>
      </properties>
    </configuration>
    <deployer>
    </deployer>
    <deployables>
      <deployable type="war" file="target/spa.war"></deployable>
      </deployables>
    </configuration>
  </plugin>

我通过改变地址来使用另一个端口。

I used another port by changing the address like so.

-Xrunjdwp:transport = dt_socket,server = y,suspend = y,address = 9009

然后我通过转到为远程创建了一个IntelliJ运行配置。 运行>编辑配置> +>远程我将远程配置为localhost和我之前选择的端口< 9009>。

I then created an IntelliJ run config for a remote by going to. Run > Edit Configurations > + > Remote I configured the remote to go to localhost and the port I had previously chosen <9009>.

执行此操作后,我可以启动货运,然后启动调试器作为单独的过程来启用窃听。

After doing this I can start the cargo run and then start the debugger as a separate process to enable bugging.

如果需要,可以将suspend参数更改为no。

If you want you can change the suspend argument to no like so.

-Xrunjdwp:transport = dt_socket,server = y,suspend = n,address = 9009

然后货运构建将在不运行调试器的情况下启动。

Then the cargo build will start without running the debugger.

这篇关于本地调试应用程序在tomcat上启动,货物在IntelliJ中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 15:53