Search code examples
javaeclipsemavenjunit4surefire

Redirect maven test logging to eclipse console


I run my tests using maven surefire plugin. When I need to debug the code, I use
mvn -Dmaven.surefire.debug test to redirect to eclipse debugger.

This works well, but the log statements are not redirected to eclipse console. Is there anyway we can redirect log and System.out statements to eclipse console view.

I tried setting useFile=false and maven.test.redirectTestOutputToFile=false properties. These options don't seem work.


Solution

  • You can call any commandline process from eclipse by adding it as an External Tool.

    First, open the external tools dialog:

    External Tools Configurations...

    Then, add a new tool...

    Add a new tool

    And configure it to do what you want

    Configure it to call maven

    You should then be able to start your test from the external tools menu, and have all of the output directed to the Eclipse console.

    Run External Tool from menu