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 246176 - When executing tests on Maven, Compile-on-Save does not catch changes in other modules
Summary: When executing tests on Maven, Compile-on-Save does not catch changes in othe...
Status: RESOLVED DUPLICATE of bug 248628
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 8.0
Hardware: PC Mac OS X
: P3 normal with 1 vote (vote)
Assignee: Tomas Stupka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-31 23:44 UTC by ebakke
Modified: 2015-06-16 14:16 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 ebakke 2014-07-31 23:44:04 UTC
When Compile-on-Save is enabled on Maven-based NetBeans module projects, the Compile-on-Save system normally picks up changes in any module on which the platform application depends. This also works when executing a class with a main method--I can change source files in any module on which the module containing the main class depends, and when I run the main class again, the changes are incorporated into the newly executed build. However, when running JUnit tests, only changes in the module containing the test seem to be taken into account.

To reproduce (the way I just did it on NetBeans 8.0):
* Create a new Maven-based NetBeans Platform project, and add two new modules (let's call them ModuleA and ModuleB). Make sure Compile-on-Save is enabled.
* In ModuleA, create a class with a single static method that returns a string "Foo1", say SomeClass.getFoo(). Make the package containing it a public package.
* Have ModuleB depend on ModuleA.
* In ModuleA, create a class MainClass with a main method in it, and a JUnit test class TestClass with a JUnit test method in it. Do a "System.out.println(SomeClass.getFoo())" from both of them.
* Clean and build.
* Run MainClass; it should print "Foo1". Test the TestClass; it should also print "Foo1".
* Now change "Foo1" to "Foo2" in ModuleA.
* Run MainClass again; it will correctly print "Foo2".
* Test TestClass again; it will now, incorrectly, still print "Foo1". Only once ModuleA is built manually will the JUnit test print "Foo2". Note that changes to TestClass itself, or any other class in ModuleB, will still correctly be picked up by Compile-on-Save when running the JUnit test in ModuleB.

(Compile-on-Save with Maven-based NetBeans Module projects has worked really great for me in the past year, by the way. It's a really invaluable feature.)
Comment 1 peathal 2014-10-14 07:58:25 UTC
+1, my main problem with NetBeans these days!
Comment 2 Geertjan Wielenga 2014-10-14 08:17:08 UTC
ebakke is referring to Maven-based NetBeans module projects. Are you creating Maven-based NetBeans module projects, peathal? I don't think you are doing that. Can you be very very very descriptive about the kinds of applications you are creating and the steps we need to take to reproduce your very very very specific issue?
Comment 3 peathal 2014-10-14 08:46:45 UTC
Sorry, indeed I'm using normal maven modules. I'll create a new issue then? I'll have some more time in the next days and will try a fresh computer, repo and make a reproduction possible as this is very important to me.
Comment 4 peathal 2014-10-16 13:56:07 UTC
I've reported a new issue related to normal 'maven submodules' here:

https://netbeans.org/bugzilla/show_bug.cgi?id=247982
Comment 5 Tomas Stupka 2015-06-16 14:16:07 UTC
perhaps a duplicate of issue #248628

feel free to reopen in case you are able to reproduce with a current build or if your problem does not fit as described in #248628

*** This bug has been marked as a duplicate of bug 248628 ***