TeamCity自定义通知程序未运行

时间:2012-04-26 13:21:44

标签: java build teamcity

因此,我创建了一个简单的团队城市通知程序,此时只会将一些信息记录到我的C驱动器中,但只要在TeamCity上触发构建,通知程序就不会运行。我不确定我错过了什么。这是我到目前为止所拥有的。 MyLogger类只是获取一个简单的java.util.logging.Logger对象,它在C盘上创建一个日志。

以下是我对Notificator界面的实现:

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

    }

}

这是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>

我在同一个jar中将类和build-server-plugin.xml打包在一起。在jar中有两个单独的目录,有com.testnot和META-INF。也许我没有正确地打包它们。我不完全确定我做错了什么。任何有用的帮助将不胜感激。我一直在使用找到的here.

示例

1 个答案:

答案 0 :(得分:1)

所以在最终找到日志后,我发现你必须使用Java 6编译插件,它与Java 7不兼容。经过这次更改后,插件现在正在运行。