This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 202345 - Netbeans use ant runner to run unit test in a maven project
Summary: Netbeans use ant runner to run unit test in a maven project
Status: RESOLVED INVALID
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.0.1
Hardware: PC Windows XP
: P3 normal with 1 vote (vote)
Assignee: Jesse Glick
URL:
Keywords:
Depends on: 204907
Blocks:
  Show dependency tree
 
Reported: 2011-09-20 09:34 UTC by edvicif
Modified: 2011-11-09 22:45 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description edvicif 2011-09-20 09:34:43 UTC
I don't know what triggers this, but when it happens the problem remains constant and cannot sorted out even with restart.

When I'm working with maven project I want to run unit test through maven surefire. Because for example the project settings quite complex and it is difficult to reproduce in netbeans.

Most of the time, when I open the project and ask for clean & build or run a single unit tests netbeans do delegate this responsibility to maven. But for unknown circumstances sometimes for run single unit test or debug single unit test instead of surefire it begins to use some sort of ant runner.

The project default action for Test or Debug Unit Test is still set to run maven with certain parameter. Even if I copy those settings into a Custom maven running configuration netbeans works as expected. (Brings up unit test report window, debug function works fine).

But from now on no matter what I do if I right click on the unit test and press run, it uses the ant runner.
Comment 1 edvicif 2011-09-20 09:51:29 UTC
I found a way to reproduce the issue.

Create a maven java project with netbeans.

Go to the generated AppTest unit test. Right click Run Test...
All works fine.

Now go to the App class. Add something that netbeans highlights it as compile error. (I added random characters after the class closing '}').

Right click on the AppTest run unit tests. It will warn about compile time errors. Say OK.

Unit test will pass. But if you check the configuration (Yellow double arrow in the output window). It shows it configures now ant.

Fix the App class.

Try to run the unit test. Again it uses the ant runner and it will stay now like this.

My suggestion is that this option should be configurable. Run unit test with ant or maven.

If this is some kind of requirement that unit test should be run, without compilation it can be achieved by just running surefire:test goal.
Comment 2 Jesse Glick 2011-10-18 18:08:14 UTC
Compile on Save is enabled for tests by default in Maven projects, as this allows iterative testing much more quickly than running mvn would allow. If your POM uses special build steps or Surefire options which are not correctly mirrored by the IDE's "quick test" mode, just disable CoS in the Compile panel.