So, I’ve created a simple team city notifier which will just log some information to my C drive at the moment, but whenever a build is triggered on TeamCity, the notifier doesn’t run. I am not sure what I am missing. Here’s what I have thus far. The MyLogger class just gets a simple java.util.logging.Logger object that creates a log on the C drive.
Here is my implementation of the Notificator interface:
import java.util.Collection;
import java.util.Set;
import java.util.logging.Logger;
import jetbrains.buildServer.Build;
import jetbrains.buildServer.notification.Notificator;
import jetbrains.buildServer.notification.NotificatorRegistry;
import jetbrains.buildServer.responsibility.ResponsibilityEntry;
import jetbrains.buildServer.responsibility.TestNameResponsibilityEntry;
import jetbrains.buildServer.serverSide.SBuildType;
import jetbrains.buildServer.serverSide.SProject;
import jetbrains.buildServer.serverSide.SRunningBuild;
import jetbrains.buildServer.serverSide.STest;
import jetbrains.buildServer.serverSide.mute.MuteInfo;
import jetbrains.buildServer.tests.TestName;
import jetbrains.buildServer.users.SUser;
import jetbrains.buildServer.vcs.VcsRoot;
public class TestNotificator implements Notificator {
private Logger log;
public TestNotificator(NotificatorRegistry nR) {
log = MyLogger.getLogger();
log.info("Registering the Notificator");
nR.register(this);
}
public void doNotifications(SRunningBuild arg0) {
log.info("Do Notifications has been called");
}
@Override
public String getDisplayName() {
return "Test Notificator";
}
@Override
public String getNotificatorType() {
return "testNotificator";
}
@Override
public void notifyBuildFailed(SRunningBuild arg0, Set<SUser> arg1) {
log.info("Build has failed");
doNotifications(arg0);
}
@Override
public void notifyBuildFailedToStart(SRunningBuild arg0, Set<SUser> arg1) {
// TODO Auto-generated method stub
}
@Override
public void notifyBuildFailing(SRunningBuild arg0, Set<SUser> arg1) {
// TODO Auto-generated method stub
}
@Override
public void notifyBuildProbablyHanging(SRunningBuild arg0, Set<SUser> arg1) {
// TODO Auto-generated method stub
}
@Override
public void notifyBuildStarted(SRunningBuild arg0, Set<SUser> arg1) {
// TODO Auto-generated method stub
}
@Override
public void notifyBuildSuccessful(SRunningBuild arg0, Set<SUser> arg1) {
log.info("Build was Successfull");
doNotifications(arg0);
}
@Override
public void notifyLabelingFailed(Build arg0, VcsRoot arg1, Throwable arg2,
Set<SUser> arg3) {
// TODO Auto-generated method stub
}
@Override
public void notifyResponsibleAssigned(SBuildType arg0, Set<SUser> arg1) {
// TODO Auto-generated method stub
}
@Override
public void notifyResponsibleAssigned(TestNameResponsibilityEntry arg0,
TestNameResponsibilityEntry arg1, SProject arg2, Set<SUser> arg3) {
// TODO Auto-generated method stub
}
@Override
public void notifyResponsibleAssigned(Collection<TestName> arg0,
ResponsibilityEntry arg1, SProject arg2, Set<SUser> arg3) {
// TODO Auto-generated method stub
}
@Override
public void notifyResponsibleChanged(SBuildType arg0, Set<SUser> arg1) {
// TODO Auto-generated method stub
}
@Override
public void notifyResponsibleChanged(TestNameResponsibilityEntry arg0,
TestNameResponsibilityEntry arg1, SProject arg2, Set<SUser> arg3) {
// TODO Auto-generated method stub
}
@Override
public void notifyResponsibleChanged(Collection<TestName> arg0,
ResponsibilityEntry arg1, SProject arg2, Set<SUser> arg3) {
// TODO Auto-generated method stub
}
@Override
public void notifyTestsMuted(Collection<STest> arg0, MuteInfo arg1,
Set<SUser> arg2) {
// TODO Auto-generated method stub
}
@Override
public void notifyTestsUnmuted(Collection<STest> arg0, MuteInfo arg1,
SUser arg2, Set<SUser> arg3) {
// TODO Auto-generated method stub
}
}
Here’s the build-server-plugin.xml
<?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="testNotifier" class="com.testnot.TestNotificator"/>
</beans>
I package up the class and build-server-plugin.xml together in the same jar. In the jar there are two separate directories there is com.testnot and META-INF. Maybe I’m not packaging them up correctly. I’m not entirely sure what I’m doing wrong. Any help what-so-ever would be greatly appreciated. I have been using the example found here.
So after finally finding the logs, I discovered that you must compile the plugins with Java 6, it is not compatible with Java 7. After this change, the plugins are now running.