Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Dealing with Eclipse-based IDE

Table of Contents

  1. Introduction
  2. Openning your Maven Project in Eclipse
  3. Running your Maven Project in Eclipse
  4. Debugging your Maven Project in Eclipse
    1. Generic Debugging
    2. Surefire Debugging

Introduction

TODO

Openning your Maven Project in Eclipse

TODO

Running your Maven Project in Eclipse

TODO

Debugging your Maven Project in Eclipse

Note that there two debug modes in maven (AFAIK): the generic, and the surefire. You'd need a different approach with the surefire debugging since it forks your tests in another jvm.

Generic Debugging

  1. Setting up Maven
    1. open %M2_HOME%/bin/mvn.bat
    2. At line 30 (more or less), you'll find this, "@REM set MAVEN_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000". Delete @REM (Thus, uncommenting that line)
    3. save that file as mvn-dbg.bat (or any convinient name you may want). You now have to maven batch files, one for normal use, and one for debugging.
    4. Run your maven command but use "mvn-dbg" instead of "mvn" (i.e. instead of "mvn install", use "mvn-dbg install")
  2. From your Eclipse,
    1. Select break points in the code you're running.
    2. Run > Debug > Remote Java Application > New Launch Configuration > Debug
    3. Select the maven project that you wish to step through, and set "Port" to 8000 (the default, unless you modified that part of the mvn batch/script file)
    4. Press "Debug" button to start debugging

Debugging your Tests

  1. From your command line,
    1. Append -Dmaven.surefire.debug to your maven command (i.e mvn install -Dmaven.surefire.debug).
    2. Wait for your maven to pause its execution and display the message, "Listening for transport dt_socket at address: 5005".
  2. From your Eclipse,
    1. Select break points in the code you're running.
    2. Run > Debug > Remote Java Application > New Launch Configuration > Debug
    3. Select your Project, and set "Port" to 5005
    4. Press "Debug" button to start debugging
  • No labels