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 195706 - Ant integration
Summary: Ant integration
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Project (show other bugs)
Version: 7.1
Hardware: PC Linux
: P3 normal with 6 votes (vote)
Assignee: Tomas Mysik
: 195708 (view as bug list)
Depends on:
Blocks: 195708
  Show dependency tree
Reported: 2011-02-19 21:25 UTC by PhilLello
Modified: 2012-10-20 20:49 UTC (History)
0 users

See Also:
Exception Reporter:

Initial patch (8.44 KB, patch)
2011-02-21 18:36 UTC, PhilLello
Details | Diff
Proposed patch (20.11 KB, patch)
2011-02-23 18:13 UTC, PhilLello
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description PhilLello 2011-02-19 21:25:30 UTC
It would be extremely useful if ant support was more closely integrated into the PHP extension.

I say more closely, because Ant can be used by adding a build.xml to the project.

This is primarily to allow complex deployment scenarios, where some static site content needs pulling from external sources, or is an artefact from a different project type, or generated from SCM history.

The current deployment mechanisms (FTP and local-copy) can easily be implemented as ant tasks, so it's worth making this change too, so that ant can run the same deployments without duplicating config.

I'm starting to look into this now (waiting for my clone to finish), please ping me if anyone else is looking at this too.
Comment 1 PhilLello 2011-02-19 22:35:50 UTC
Making deployment a separate feature, dependant on this one, as hooking run/debug behaviour shouldn't wait for an ant-based implementation of org.netbeans.modules.php.project.connections.spi.RemoteClient
Comment 2 PhilLello 2011-02-21 18:36:52 UTC
Created attachment 106265 [details]
Initial patch

I've created an initial patch to release6.9_m1, which does the following:

- Enables build/rebuild is a build.xml is present in the project root
- Calls the ant 'build' and 'rebuild' targets.

Still to do:

- Hook into run/debug to run build first (not checked if the IDE does this by default)
- Probe build.xml to check if run/debug targets actually exist
- Add a context menu to the project view to create skeleton build.xml
- Lots of testing(!)

Feedback welcome

Phil Lello
Comment 3 PhilLello 2011-02-23 18:13:12 UTC
Created attachment 106356 [details]
Proposed patch

This is my (probably) final version of the patch, until feedback is received.

A 'Add Ant Support' option now appears on right-click on the project root, but only if build.xml isn't already present. This will create a default build.xml for customisation.

The ant targets build and rebuild are now probed for, rather than just checking that the build.xml exists.

The build target is called before build/run, as I've added a wrapper around the factory method in ConfigAction.

I've removed obsolete copyright notices from my files, as they are now IDE generated (originally I copied existing actions, but the currently reported Oracle vs Google FUD makes me nervous about implementing sub-classes this way).
Comment 4 PhilLello 2011-05-29 22:52:22 UTC
Raised version number, as the current patch applies against the current codebase too (with a manual fix to the reject on import lines).
Comment 5 Tomas Mysik 2011-06-03 11:12:37 UTC
*** Bug 195708 has been marked as a duplicate of this bug. ***
Comment 6 Tomas Mysik 2011-06-03 11:16:16 UTC
Wow, thanks for the patch, really! However, I would strongly prefer to have such support _optional_. Why? Because Ant is for Java projects and is not well-known in PHP community; Phing is the Ant alternative for PHP.

So, maybe we could try to provide this functionality in a separate module - would you like to look at it?
Comment 7 TigersWay 2011-08-02 09:03:49 UTC
I'd love to hear news about this one!

@Tomas Mysik, I do agree with you on the option part, but not really on phing part :-)  Ant can be easily there, so why not use it?

Thanks to follow
Comment 8 LukeScott 2011-09-02 16:00:16 UTC
I would really like to see this either built in or be an optional module. It would be nice the to have my Build/Clean buttons functional. (Right now I'm doing it directly on my build.xml file)
Comment 9 PhilLello 2011-10-25 01:17:48 UTC
I'm planning on having another look at this; I don't recall seeing a way to do this as a standalone plugin, but that may just be lack of imagination on my part :)

The reason for choosing ant over phing was pretty simple; netbeans already includes support for ant (and installs it), so the required work was minimal.

Although Phing support could be added, this would complicate the dependancies - it's quite possible at the moment to use netbeans on a machine without PHP install, and deploy projects remotely.

That said, Phing is just a PHP implementation of Ant (flame me now), so it should be possible to create a Phing wrapper that is compatible. I probably won't be the one to do it.
Comment 10 hermes85pl 2012-10-20 20:49:34 UTC
Having used Java EE projects in NetBeans I find the lack of support for Ant in PHP projects really frustrating. Synchronization via FTP in NetBeans PHP projects is great, yet before deploying my application I would like to run some tasks in order to e.g. minimize JavaScript. Now there is absolutely no way to do this. Using Ant is an obvious thing. I am missing it badly.

And how about HTML5 projects? Does every project type have to be that much different? Why can't there be a HTML5-like project that uses Ant and allows you to add support for PHP or any other script language supported by the IDE? Adding Ant to PHP projects would be the first step towards simplification by unification.