簡體   English   中英

本地調試應用程序在tomcat上啟動,貨物在IntelliJ中

[英]Local debugging application launched on tomcat with cargo in IntelliJ

我正在嘗試在我的貨物配置中啟用調試。 我正在使用具有以下配置的cargo-maven2-plugin版本1.4.19。

<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?

我這樣修好了。

<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>

我通過改變地址來使用另一個端口。

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

然后,我通過轉到為遠程創建了一個IntelliJ運行配置。 Run > Edit Configurations > + > Remote我將遠程配置為localhost和我之前選擇的端口<9009>。

在此輸入圖像描述

執行此操作后,我可以啟動貨物運行,然后啟動調試器作為單獨的過程來啟用竊聽。

如果需要,可以將suspend參數更改為no。

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

然后貨運構建將在不運行調試器的情況下啟動。

對於gradle 4.3.0 ,在json路徑cargo>local添加以下參數,

jvmArgs = "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000

並啟動應用程序使用,

./gradlew cargoRunLocal

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM