How to get TeamCity / Spring to recognize 3rd party libraries called within Agent code


Please forgive what could end up being a Spring 101 question - I'm only now picking it up with teamcity plugin development.

Within an agent plugin's code, I'm attempting to call a 3rd party library.  More specifically, I'm instantiating an object for which the source is not available.  With what I've done, I keep getting a NoClassDefFoundError.

With the following spring wiring:

<?xml version="1.0" encoding="UTF-8"?> <beans xmlns=""        xmlns:xsi=""        xmlns:lang="" xmlns:aop=""        xmlns:context=""        xsi:schemaLocation="                                                      "        default-autowire="constructor">   <bean id="conanCommandLineProcessor" />   <bean id="kwcitcpluginAgentListener" />   <bean id="projectBuilder" /> </beans>

The first two beans are a part of the agent code and work as designed.  The AgentListener tries to create an instance of ProjectBuilder without success.
I've tried what's shown in the 3rd bean line with no success.  I've also modified the agent's agent.bat file and added ProjectBuilder's containing jar file to the classpath.  As well, I've looked at 'depends' attributes on the beans and a few other options but I just haven't hit upon the success path.

How can I get my agent plugin to find and the external classes?

Thank you very much in advance,

1 comment
Comment actions Permalink

Hi Nic,

If you are just creating a usual calss instance af a library, you do not need Sping here. Just create it as uaul, via "new ProjectBuilder(...)", you obviously need to make the class available to the JVM and the most simple way to do that is to put the library jar near the jar holding your plugin's classes. In the final packaged agent plugin, that is under "lib" of the agent part. You can go explore existing plugins packaging for examples.


Please sign in to leave a comment.