Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Can I include Ant tasks as plugins for the Ant External Tools Dialog?(Plugins for Ant extension)
icon1.gif  Can I include Ant tasks as plugins for the Ant External Tools Dialog? [message #514499] Mon, 15 February 2010 15:43 Go to next message
Jose  is currently offline Jose Friend
Messages: 5
Registered: February 2010
Junior Member
Hello,

I am developing a plugin for extending Ant runtime with some additional tasks. This is a sample of what I am trying to do:


<extension point="org.eclipse.ant.core.antTasks" id="eyd.groovy.task">    
		<antTask name="groovy" class="org.codehaus.groovy.ant.Groovy" library="lib/groovy-all-1.7.0.jar"/>   
	</extension>
	
	<extension
         point="org.eclipse.ant.core.extraClasspathEntries" id="eyd.groovy.libpath">
      <extraClasspathEntry
            library="lib/groovy-all-1.7.0.jar">
      </extraClasspathEntry>
   </extension>


This extension is available for execution from the Run->Eclipse Application dialog but I would like to make it available for the Run->External Tools Configurations->Ant Build dialog which is closer to what an Ant user is used to handle and has much more Ant-oriented options.

Could you give me any suggestions on how to do that?

Thanks.
Re: Can I include Ant tasks as plugins for the Ant External Tools Dialog? [message #514524 is a reply to message #514499] Mon, 15 February 2010 16:49 Go to previous messageGo to next message
Steffen Zschaler is currently offline Steffen ZschalerFriend
Messages: 266
Registered: July 2009
Senior Member
Not sure I completely understand your question: The extensions you
define below define new ant tasks. That is, when the plugin defining
these extensions is installed in Eclipse, these ant tasks should be
available in any ant script a developer writes. Such an ant script can
then be executed using Run->External Tools Configurations->Ant Build as
usual.

Could you be a bit more specific about your setup and what happens as
opposed to what you expect to happen?

Cheers,

Steffen

On 15/02/2010 15:43, Jose wrote:
> Hello,
>
> I am developing a plugin for extending Ant runtime with some
> additional tasks. This is a sample of what I am trying to do:
>
>
> <extension point="org.eclipse.ant.core.antTasks" id="eyd.groovy.task">
> <antTask name="groovy" class="org.codehaus.groovy.ant.Groovy"
> library="lib/groovy-all-1.7.0.jar"/> </extension>
>
> <extension
> point="org.eclipse.ant.core.extraClasspathEntries"
> id="eyd.groovy.libpath">
> <extraClasspathEntry
> library="lib/groovy-all-1.7.0.jar">
> </extraClasspathEntry>
> </extension>
>
> This extension is available for execution from the Run->Eclipse
> Application dialog but I would like to make it available for the
> Run->External Tools Configurations->Ant Build dialog which is closer
> to what an Ant user is used to handle and has much more Ant-oriented
> options.
>
> Could you give me any suggestions on how to do that?
>
> Thanks.
>
Re: Can I include Ant tasks as plugins for the Ant External Tools Dialog? [message #514532 is a reply to message #514524] Mon, 15 February 2010 17:17 Go to previous messageGo to next message
Jose  is currently offline Jose Friend
Messages: 5
Registered: February 2010
Junior Member
Steffen, the behaviour you have described is exactly what I expected to obtain. However, it seems that the org.eclipse.ant.ui plugin which is the provider for the Run->External Tools Configurations->Ant Build dialog is not loading the ant task extensions.

I have checked that the extensions are available by looking at Window->Preferences->Ant->Runtime. Extensions can be used if launched from the Run->Eclipse Application dialog, but this is not very convenient because the user has to provide Ant parameters (such as the location of the build file or the build target to be executed) inside an Eclipse launch application form instead of using the Ant Build dialog.
Re: Can I include Ant tasks as plugins for the Ant External Tools Dialog? [message #514684 is a reply to message #514532] Tue, 16 February 2010 10:27 Go to previous messageGo to next message
Steffen Zschaler is currently offline Steffen ZschalerFriend
Messages: 266
Registered: July 2009
Senior Member
Hi Jose,

I'm a bit confused. What do you mean by 'Run->External Tools
Configurations->Ant Build dialog is not loading the ant task
extensions.'? What did you do to determine that? What do you mean by
"Extensions can be used if launched from the Run->Eclipse Application
dialog"? How do you start ant from this dialog?

Or are you saying that you can use your tasks after you have started a
second Eclipse using the Run->Eclipse Application dialog? In this case,
this would be as expected, because this is when your plugin first is
deployed.

Sorry to be so unhelpful,

Steffen

On 15/02/2010 17:17, Jose wrote:
> Steffen, the behaviour you have described is exactly what I expected
> to obtain. However, it seems that the org.eclipse.ant.ui plugin which
> is the provider for the Run->External Tools Configurations->Ant Build
> dialog is not loading the ant task extensions.
> I have checked that the extensions are available by looking at
> Window->Preferences->Ant->Runtime. Extensions can be used if launched
> from the Run->Eclipse Application dialog, but this is not very
> convenient because the user has to provide Ant parameters (such as the
> location of the build file or the build target to be executed) inside
> an Eclipse launch application form instead of using the Ant Build dialog.
Re: Can I include Ant tasks as plugins for the Ant External Tools Dialog? [message #514699 is a reply to message #514684] Tue, 16 February 2010 11:47 Go to previous messageGo to next message
Jose  is currently offline Jose Friend
Messages: 5
Registered: February 2010
Junior Member
Let me try to explain in details the steps I take to test this extension:

1) I have an Eclipse executing, with my plugin with Ant extensions as a project in the workspace. Let me call this Eclipse instance the "dev instance".
2) From this Eclipse instance I start another Eclipse instance using the Run->Run Configurations->Eclipse Application dialog. With this operation I intend to obtain an Eclipse environment extended with the functionalites included in my plugin. I will call this second Eclipse instance the "test instance".
3) In the "test insance" I can see that the extensions are loaded by having a look at Window->Preferences->Ant->Runtime->Tasks, e.g. I can see that the groovy task appear in the tasks folder.
4) I load a Java project in the workspace of the "test instance" with a build.xml file with this contents:

<project name="mytest" basedir="." default="test">    
	<target name="test">
		<groovy>
			println "This is a groovy hello world"			
		</groovy>
	</target>       
</project>


This build.xml file is just a quick way to test the Ant task extension.

5) Trying to execute this target with "Run as Ant Build" fails with this message:

BUILD FAILED
build.xml: Problem: failed to create task or type groovy
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.


The run configuration behind the "Run as Ant Build" does not have any classpath reference to the groovy.jar file so I concluded that the extension was not being propagated to this Ant run dialog because the <groovy> element is not correctly recognised.

6) If I execute the build.xml file using the "Run->Eclipse Aplication" I obtain the "Hello world groovy messsage".

I hope this helps you understand the test scenario I am using. I may be missing something...

Thank you very much for your attention.
Re: Can I include Ant tasks as plugins for the Ant External Tools Dialog? [message #514715 is a reply to message #514699] Tue, 16 February 2010 12:43 Go to previous message
Jose  is currently offline Jose Friend
Messages: 5
Registered: February 2010
Junior Member
I forgot to mention that in step 6) I change the default selection in the "Program to run" from Run a product->org.eclipse.platform.ide to Run an application->org.eclipse.ant.core.antRunner
Re: Can I include Ant tasks as plugins for the Ant External Tools Dialog? [message #514766 is a reply to message #514715] Tue, 16 February 2010 10:16 Go to previous message
Steffen Zschaler is currently offline Steffen ZschalerFriend
Messages: 266
Registered: July 2009
Senior Member
Hi Jose,

This could be related to the settings for your extensions. Both the
anttask and the extraClasspathEntry elements support a flag called
eclipseRuntime. Set this to false to indicate that the tasks and jar
files should be made available also in VMs other than the one currently
running Eclipse.

I've had similar problems in the past and had to do a bit of
experimenting to get it to work. Something seems to be a bit strange in
the ANT plugin's management of classpaths etc., but I haven't quite
figured it out yet.

Cheers,

Steffen

On 16/02/2010 12:43, Jose wrote:
> I forgot to mention that in step 6) I change the default selection in
> the "Program to run" from Run a product->org.eclipse.platform.ide to
> Run an application->org.eclipse.ant.core.antRunner
Previous Topic:Problem launching java apps
Next Topic:Internal Error when creating method/class with Quick Fix
Goto Forum:
  


Current Time: Thu Apr 25 02:32:46 GMT 2024

Powered by FUDForum. Page generated in 0.03109 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top