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 252595 - Missing "onsave" project hook for J2SE Ant build.xml
Summary: Missing "onsave" project hook for J2SE Ant build.xml
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 8.0.1
Hardware: PC Linux
: P3 normal (vote)
Assignee: Tomas Zezula
URL:
Keywords:
Depends on: 269161
Blocks:
  Show dependency tree
 
Reported: 2015-05-26 14:25 UTC by Jaroslav Tulach
Modified: 2016-11-29 11:14 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Replacing .netbeans* files with a query like approach (8.28 KB, patch)
2016-06-10 09:11 UTC, Jaroslav Tulach
Details | Diff
Proposed patch (65.65 KB, patch)
2016-08-11 15:18 UTC, Tomas Zezula
Details | Diff
Proposed patch (92.83 KB, patch)
2016-08-15 12:28 UTC, Tomas Zezula
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jaroslav Tulach 2015-05-26 14:25:54 UTC
I am currently working on Graal and using NetBeans. In Graal one can use any IDE, just call:

$ mx.sh ideinit

and you should be able to open all the projects in any IDE. That allows people to compare:

One thing where NetBeans lacks behind Eclipse is compile on save feature.

After a bit of analysis it turned out that the missing piece is ability to invoke a custom trigger when Java file is saved and its .class file is generated. Such hook would allow us to register code to JAR the classes into appropriate location, etc.

One possible way to realize this is a property in project.properties

$onsave=nameoftarget

which would invoke

ant -f build.xml nameoftarget

on the main build script.
Comment 1 Jaroslav Tulach 2016-05-25 06:09:51 UTC
Ping?
Comment 2 Tomas Zezula 2016-06-07 15:54:42 UTC
Fixed jet-main a99b75ac5d61
Comment 3 Jaroslav Tulach 2016-06-10 08:15:28 UTC
I've added support in MX to generate $cos.update:
https://github.com/jtulach/mx/commit/e26f91d6a6070820c56fd764bd2aa36ca0112224

That isn't however enough. NetBeans needs to really get convinced to enable CoS. Currently that could be:
https://github.com/jtulach/mx/commit/f1c260d40485d8010b0833909bd84e0b42c6d20b
Comment 4 Jaroslav Tulach 2016-06-10 09:11:14 UTC
Created attachment 160026 [details]
Replacing .netbeans* files with a query like approach

I am not really satisfied with https://github.com/jtulach/mx/commit/f1c260d40485d8010b0833909bd84e0b42c6d20b 

I believe this patch better suites the over NetBeans project philosophy: ask a query and give the projects an ultimate control over the final decision.

I believe that existence of $cos.update property is a great indicator of the user will to really enable CoS.
Comment 5 Jaroslav Tulach 2016-06-10 09:13:04 UTC
With the attached patch, it is enough to use just https://github.com/jtulach/mx/commit/e26f91d6a6070820c56fd764bd2aa36ca0112224 and get reasonable CoS behavior for all mx based projects.
Comment 6 Jaroslav Tulach 2016-07-22 09:24:49 UTC
Tomáši, I know you were working on "ResourceSet" that could be used from the Ant task to copy the class files/resource files. Can you update this issue with information about such enhancement? Thanks.
Comment 7 Tomas Zezula 2016-08-11 15:18:58 UTC
Created attachment 161629 [details]
Proposed patch
Comment 8 Tomas Zezula 2016-08-15 12:28:16 UTC
Created attachment 161664 [details]
Proposed patch

Patch with FileBuiltQuery.
Comment 9 Tomas Zezula 2016-08-15 14:31:59 UTC
Fixed jet-main 4c7e68ea7d33
Comment 10 Jaroslav Tulach 2016-08-23 15:38:01 UTC
I wrote some documentation at http://wiki.netbeans.org/FaqCompileOnSave#Custom_Actions_on_Compile_on_Save
Comment 11 Tomas Zezula 2016-08-25 05:11:37 UTC
Thanks a lot Jardo!
BTW: Any idea about the unexpected changes?
Comment 12 Quality Engineering 2016-08-27 02:18:50 UTC
Integrated into 'main-silver', will be available in build *201608270002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/4c7e68ea7d33
User: Tomas Zezula <tzezula@netbeans.org>
Log: #252595:Missing "onsave" project hook for J2SE Ant build.xml