AntTaskExtension

Hi,

I'm trying to piece together the info I've found regarding building plugins.  I found a mention of implementing AntTaskExtension to customize ant builds but there is little more information than that.  So I implemented the interface and wrote the following build-agent-plugin.xml (like the one in this thread - http://www.intellij.net/forums/thread.jspa?messageID=5213711).  Then I jarred and zipped it up with the consistent to the other plugin zips that I looked at.

<container>
  <component />
</container>

I pushed it to my server's update/plugins directory and it was propogated to agents and unzipped.  But there is no sign that it had any affect (I added a bunch of printlns and logger.warning() calls).

So I have a bunch of questions about this which I haven't found answers for.

  1. Is this a container / component XML proper for an Ant extension?
  2. Does the XML need to also include info about the base Ant plugin?
  3. Should the extension be packed as a standalone jar/zip or does it need to be packed into the antPlugin.zip?
  4. Will any extensions be applied to all ant builds or should a different server plugin be added to trigger the agent to use the customized version?


Thanks,
Tom

5 comments
Comment actions Permalink

To be consistent with server side plugins in TeamCity 4.0 we changed container from PicoContainer to Spring on the agent too. So you need to change your bean descriptor to something like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans default-autowire="constructor">
  <bean id="MyAntExtension" />
</beans>

--
Pavel Sher

0
Comment actions Permalink

Hi Pavel,

I changed my build-agent-plugin.xml as you suggested.  Now here's what I have:

Java

  • jetbrains.buildServer.agent.ant.MyAntExtension (extends Object) implements AntTaskException


Jar contains this only:

  • /META-INF/build-agent-plugin.xml
  • /META-INF/MANIFEST.MF
  • /jetbrains/buildServer/agent/ant/MyAntExtension.class


Zip file:

  • buildMyAntExtensionPlugin/lib/myAntExtensionRunner.jar


And again, no output in any of the logs from System.out.println() and logger.warning() calls. 

So I guess I'm still not really clear how this fits in with the original Ant runner.  What tells the Ant plugin to use my extension?  Do I need to extend the Ant runner (missing from javadoc btw)?  Do any implementations of AntTaskException apply to all Ant builds?  Do I also need to create a new server plugin to use with the agent extension plugin?

Thanks,
Tom

0
Comment actions Permalink

Could you please send your extension to teamcity-feedback?

--
Pavel Sher

0
Comment actions Permalink

Your plugin has been started successfully in my environment. The only thing I've done - I removed @Override annotations because AntTaskExtension is an interface. Messages were logged to the build log and I can see them in the TeamCity web UI.

--
Pavel Sher

0
Comment actions Permalink

As it turns out the problem was apparently with the way my jar was packed.  I was creating it with my zip program instead of Java's jar.  When I repacked it via jar everything worked fine.

Thanks for your help,
Tom

0

Please sign in to leave a comment.