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

« Previous Version 2 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: the Generic, and the Surefire. If you want to debug maven itself, or a maven project of yours, use the Generic Approach. If you want to debug a test in your maven project launched by surefire, use the Surefire Approach.

Generic Debugging

  1. Setting up Maven
    1. Open %M2_HOME%/bin/mvn.bat
    2. At line 30, you'll find this,
      . 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
    3. For the Project field, select your maven project, and
    4. For the Port, set it to 8000 (8000 is the default port for the Generic Maven Debugging. But you can modify it by changing the address field shown in Generic Debugging - 1.2)
    5. Press Debug button to start debugging

Debugging your Tests

  1. From your command line,
    1. Append the following to your maven command.
      For example, to debug the tests ran by the maven lifecycle install, do mvn install -Dmaven.surefire.debug
    2. Wait for your maven to pause its execution and display the message,
  2. From your Eclipse,
    1. Select break points in the code you're running.
    2. Run > Debug > Remote Java Application > New Launch Configuration
    3. For the Project field, select your maven project, and
    4. For the Port, set it to 5005
    5. Press Debug button to start debugging
  • No labels