Debugging tests of a Maven project in NetBeans

Posted by Lucio Benfante Wed, 20 Feb 2008 17:30:00 GMT

Occasionally I experienced some problems in debugging test classes using NetBeans with Maven projects. Simply, the debugger started but didn’t attach to the running tests.

Eventually I discovered the reason!

I used to configure the surefire plugin with:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
        <skip>false</skip>
        <useFile>true</useFile>
        <forkMode>once</forkMode> <!-- always, once or never -->
        <!-- <reportFormat>plain</reportFormat> -->
        <argLine>-Xmx512M</argLine>
    </configuration>
</plugin>

The problem is the argLine parameter. It will override the parameters the Mevenide plugin will pass for debugging tests. So, I commented it in my configuration:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
        <skip>false</skip>
        <useFile>true</useFile>
        <forkMode>once</forkMode> <!-- always, once or never -->
        <!-- <reportFormat>plain</reportFormat> -->
        <!--argLine>-Xmx512M</argLine--> <!-- don't use if you want to debug tests in NetBeans -->
    </configuration>
</plugin>

...and now I can debug my tests!

Posted in ,  | Tags , , ,  | 5 comments

Comments

  1. Avatar tommyalf said 100 days later:

    Davvero interessante, io uso TestNg, lo trovo molto utile e facile da utilizzare.

    see http://tommyalf.blogspot.com/

  2. Avatar gc said 463 days later:

    Thanks. I was having the same problem, you’ve helped me much.

    This seem to be corrected in Netbeans 6.7beta

  3. Avatar gc said 463 days later:

    Thanks. I was having the same problem, you’ve helped me much.

    This seem to be corrected in Netbeans 6.7beta

  4. Avatar http://www.truereligionjean.net/ said 1185 days later:

    I gussess you will like just like brfore me.This website has a number of high quality information from there.Trust me, You have to have the courage to examine who you really are, to come to terms with the dark corner of your own soul.

  5. Avatar http://www.truereligionjean.net/ said 1185 days later:

    I gussess you will like just like brfore me.This website has a number of high quality information from there.Trust me, You have to have the courage to examine who you really are, to come to terms with the dark corner of your own soul.

(leave url/email »)

   Comment Markup Help Preview comment