Troubleshooting a Hello World plugin

I've been struggling to get a simple plugin to work with TeamCity.  The posts and online material has been helpful to get things started, but for some reason I can't get a simple plugin to function.  Perhaps another set of eyes can find the problem.

Attached is the source along with a zip of the archive you can use to install on the server.  It looks similar to a 'getting started' type post from 2008 but adding the init-method didn't work for me.

Here are the details which I think could be the root of any potential problem, otherwise check the 'helloworld.zip' for the installation of the plugin.


build-server-plugin-<name>.xml


<beans default-autowire="constructor">
  <bean id="hello" init-method="register"/>
</beans>



source code snipit of the plugin


public class BuildServerAdapterHelloWorld extends BuildServerAdapter
{


 private final static Logger LOGGER = Logger.getLogger(BuildServerAdapterHelloWorld.class.getName());
    private final SBuildServer myBuildServer;


 
 //Constructor ( Auto wired )
 public BuildServerAdapterHelloWorld(SBuildServer aBuildServer)
 {


 LOGGER.log(Level.INFO, "Hello World starting...1");
 Logger.getAnonymousLogger().log(Level.INFO, "Hello World starting...2");
 System.out.println("Hello World Starting...3");
 
 myBuildServer = aBuildServer;
 }
 
    public void register()
    {
 Logger.getAnonymousLogger().log(Level.INFO, "Hello World register...2");
     myBuildServer.addListener(this);
    }
 
 public void buildStarted(SRunningBuild build)
 {
 LOGGER.log(Level.INFO, "Hello World buildstarted...");
 Logger.getAnonymousLogger().log(Level.INFO, "Hello World buildstarted...2");
 System.out.println("Hello World buildstarted...");
 }
 
   
}


Any ideas for this novice java programmer?



Attachment(s):
helloworld.zip
3 comments
Comment actions Permalink

Hi!

Sorry for the delay in replying.

Have you managed to get the plugin working? Is the quesiton still actual?

0
Comment actions Permalink

Yegor,

In general, yes.  The plugin contents were not being packged correctly so I started with the samplePlugin provided with TeamCity and edited it to get started as it uses ant to create a functional jar file.

Question, is there a best practice for 'printf'?  The methods I tried did not result in any messages in the TeamCity\logs\*.   I used the windows UI to start/stop the service, is the logging behavior different if the service is started through the command line bat file?

0
Comment actions Permalink

Hello,

Standard output appears in other files under logs\ (e.g. catalina.out). However, you should really consider using Log4J logging instead of printing into stdout.
For an example, search for "Logger" in samplePlugin-src.zip\src\jetbrains\sample\extensions\buildQueuePause\StartBuildPrecondition.java  or in http://svn.jetbrains.org/teamcity/plugins/rest-api/trunk/src/jetbrains/buildServer/server/rest/APIController.java

0

Please sign in to leave a comment.