get ArtifactsWatcher instance
Hi,
i want to publish additional artifacts paths during build using a custom build runner. As far as I read in the documentation, this should be possible with ArtifactsWatcher. But I did not find any method to get an instance of the ArtifactsWatcher interface. Could anyone give me an hint, where I can get this instance?
Thanks,
Alex
Please sign in to leave a comment.
Hello,
In TeamCity build agent and server we widely use Spring Framework. In particular we use dependency injection. Most of open api services are available as spring bean. Please take a look at some basic documentation on it at http://static.springsource.org/spring/docs/2.5.x/reference/beans.html
To make your class (bean) (that you register in teamcity-agent-plugins-<plugin-name>.xml) an instance of ArtifactsWatcher you may simple add this interface as constructor parameter to your bean. TeamCity and SpringFramework will create an isnstance of your object (bean) with ArtifactsWatcher instance.
Please make sure you call methods of the interface only while build in agent is running, To get notifications from build agent cosinder registering a listener to agent. See jetbrains.buildServer.agent.AgentLifeCycleListener and jetbrains.buildServer.util.EventDispatcher. Extend your listener implementation from jetbrains.buildServer.agent.AgentLifeCycleAdapter