0

I am using exec-maven-plugin to execute my java app and run debug from my IDE (IntelliJ) with the following setup:

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

And it works very well. Then, I change my setup to execute a realistic java command line which would run the same app:

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

And it works to execute the application, but it does not attach the Debugger to the IDE. So, what additional argument I could add to make it catch the debug interruptions?

Joe Almore
  • 4,036
  • 9
  • 52
  • 77
  • 1
    Why not just create a Run Configuration in IDEA and run it without Maven at all? – ZhekaKozlov Jun 16 '20 at 04:29
  • or run the build up to the phase you need and continue from the command line. Use the dependency:buildclasspath goal to get your classpath – caduceus Jan 26 '21 at 09:40

1 Answers1

0

When you launch maven goal in debug mode - you are launching debug for the Maven goal process, but you need to debug the forked by the Maven goal JVM process. For this you can either

Andrey
  • 15,144
  • 25
  • 91
  • 187