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 225852 - "Apply code changes" does not have effect for Maven project
Summary: "Apply code changes" does not have effect for Maven project
Status: VERIFIED FIXED
Alias: None
Product: debugger
Classification: Unclassified
Component: Java (show other bugs)
Version: 7.3
Hardware: PC Mac OS X
: P3 normal (vote)
Assignee: Martin Entlicher
URL:
Keywords: PLAN
Depends on:
Blocks:
 
Reported: 2013-02-07 15:50 UTC by arhan
Modified: 2013-03-18 10:49 UTC (History)
4 users (show)

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 arhan 2013-02-07 15:50:29 UTC
For a maven project, in case of "Compile on save" is enabled, and "Apply code changes after save" (Settings->Java->Java Debugger) doesn't have effect after the code is recompiled. As a result, hotswap is not being triggered. 

This is crucial for JRebel to work in debug mode so that the breakpoints could be re-initialized for the new lines of code (new methods added at runtime).

For this to work, the user can push Debug->Apply Code Changes and then it triggers the compilation and update of the changed classes, however it is not very practical: users almost don't know about this feature & this is an extra step that ruins UX.

In addition, for maven projects it is not possible to run compilation for the single class via F9.

Not that this problems are not present for the non-maven projects.

The ideal workflow could be: start the app in debugger mode, make a change (add a statement in a method body), press Ctrl+S to save (which triggers compilation of "Compile on Save" is enabled. Once the compilation is complete - Hotswap should be triggered in order to update the code.

If "Apply code changes" would be supported for maven projects, the users will have much smoother debugging experience, and JRebel can leverage that as well.
Comment 1 Martin Entlicher 2013-02-12 16:32:14 UTC
I'll check what's wrong with apply code changes and Maven.
Comment 2 Martin Entlicher 2013-02-15 14:21:32 UTC
It looks like this concerns debugging of Maven WEB modules only.
When I set a CoS mode on a Maven Java project, debugger is started via ANT and "Apply code changes" works as expected.

In Maven WEB modules, CoS mode can be set for the application execution or for test execution or both. On WEB project debug, MavenDebuggerImpl.attachDebugger() is called in both CoS and non-CoS mode. But on test debug, Maven's JPDAStart is called when test execution is in non-CoS mode, but ANT's JPDAStart is called when test execution is in CoS mode.

This fixes the automatic "Apply code changes" for Maven WEB modules with CoS mode for application execution:
changeset:   246619:c0b983e93f8b
http://hg.netbeans.org/core-main/rev/c0b983e93f8b

And this fixes the automatic "Apply code changes" for debugging of Maven tests (in both Java and WEB projects), when CoS is set for the application execution only. In this case the application code is reloaded, but the test code is not.
changeset:   246621:4b171db8d546
http://hg.netbeans.org/core-main/rev/4b171db8d546
Comment 3 Quality Engineering 2013-02-17 01:49:40 UTC
Integrated into 'main-golden', will be available in build *201302162300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/c0b983e93f8b
User: mentlicher@netbeans.org
Log: #225852: Check if CoS is enabled and if yes, set listeningCP.
Comment 4 arhan 2013-03-04 21:59:36 UTC
Verified with Dev build 201303032300. Works like a charm!
Comment 5 Martin Entlicher 2013-03-13 17:27:25 UTC
Transplanted to release73 branch:
https://hg.netbeans.org/releases/rev/74023b4f3044
https://hg.netbeans.org/releases/rev/265a8b5381ab
Comment 6 Quality Engineering 2013-03-14 21:11:31 UTC
Integrated into 'releases', will be available in build *201303141828* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/74023b4f3044
User: mentlicher@netbeans.org
Log: #225852: Check if CoS is enabled and if yes, set listeningCP.
(transplanted from c0b983e93f8b3a21a13f3aafa8210624d89028eb)
Comment 7 Jiri Kovalsky 2013-03-18 10:49:49 UTC
Product Version: NetBeans IDE 7.3 (Build 201303141828)
Java: 1.7.0_15; Java HotSpot(TM) 64-Bit Server VM 23.7-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_15-b03
System: Linux version 3.0.0-12-generic running on amd64; UTF-8; cs_CZ (nb)
User directory: /home/cesilko/.netbeans/7.3
Cache directory: /home/cesilko/.cache/netbeans/7.3

Verified in NetBeans 7.3.1 build. Code changes in *.java files are automatically applied in the aforementioned setup.