The import jetbrains.buildServer.agent.AgentRunningBuild cannot be resolved

Hi All,
  I got an error against these import statements:

import jetbrains.buildServer.agent.AgentLifeCycleAdapter;
import jetbrains.buildServer.agent.AgentRunningBuild;
import jetbrains.buildServer.agent.BuildFinishedStatus;

can anyone please give an information regarding the corresponding jar file?

Regards
Shibu

4 comments
Comment actions Permalink

TeamCity\buildAgent\lib\agent-openapi.jar

Usually, you can find the necessary jar just by searching for <classname>.java within TeamCity installation JARs as in archives.

0
Comment actions Permalink

Hi Yegor,
          Thank you for your valuable reply. It was really helpful and in time for me.
Regards,
Shibu

0
Comment actions Permalink

Hi Yegor,
I want to identify a build completion on the agent using teamcity api. I tried the code snippet below.

import jetbrains.buildServer.agent.AgentLifeCycleAdapter;
import jetbrains.buildServer.agent.AgentRunningBuild;
import jetbrains.buildServer.util.EventDispatcher;
import jetbrains.buildServer.agent.BuildFinishedStatus;Agent


public class MyAgentMonitor extends AgentLifeCycleAdapter {
    
    public MyAgentMonitor(EventDispatcher<MyAgentMonitor> dispatcher) {
        dispatcher.addListener(this);
      }

    
        
    public void beforeBuildFinish(AgentRunningBuild build, BuildFinishedStatus buildStatus)
    {        
        System.out.println(" ______________________________________-- ");
        System.out.println(" Build Completion Detected ");
        
    }
    
}

Is this the right approach. Can you give me your valuble feedback.
Thanks in advance,
Shibu

0
Comment actions Permalink

I guess the class name should be "MavenAuditController".

If the bean is then defined in agent's build-agent-plugin-....xml Spring file, then the code looks OK for an even that should be processed before build finish.

0

Please sign in to leave a comment.