【发布时间】:2020-10-04 22:54:42
【问题描述】:
我正在使用 exec-maven-plugin 执行我的 java 应用程序并使用以下设置从我的 IDE (IntelliJ) 运行调试:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<executions>
<execution>
<id>exec_1</id>
<phase>deploy</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.myapp.app</mainClass>
</configuration>
</plugin>
而且效果很好。然后,我更改我的设置以执行一个现实的java 命令行,它将运行相同的应用程序:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>exec_1</id>
<phase>deploy</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>java</executable>
<arguments>
<argument>-cp</argument>
<argument>
"dir1";"dir2;etc..."
</argument>
<argument>com.myapp.app</argument>
</arguments>
</configuration>
</plugin>
它可以执行应用程序,但它不会将调试器附加到 IDE。那么,我可以添加什么额外的参数来让它捕获调试中断?
【问题讨论】:
-
为什么不在 IDEA 中创建一个运行配置并在没有 Maven 的情况下运行它?
-
或运行构建到您需要的阶段并从命令行继续。使用 dependency:buildclasspath 目标来获取你的类路径
标签: java debugging intellij-idea exec-maven-plugin