8

貨物構成でデバッグを有効にしようとしています。次の構成で 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 に接続してデバッグを有効にすることはありません。IntelliJ を JVM に接続するにはどうすればよいですか?

4

2 に答える 2

10

私はこれをこのように修正しました。

<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 > + > Remotelocalhost と以前に選択したポート <9009> にアクセスするようにリモートを構成しました。

ここに画像の説明を入力

これを行った後、貨物の実行を開始し、デバッガーを別のプロセスとして開始して、バグを有効にできます。

必要に応じて、suspend 引数を no に変更できます。

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

その後、デバッガーを実行せずに貨物ビルドが開始されます。

于 2016-04-06T11:14:26.027 に答える