【发布时间】:2016-10-17 14:39:12
【问题描述】:
我正在开发一个 TeamCity 插件,但我什至无法让 TeamCity 执行它。
我上传带有插件的 zip 文件并重新启动 TeamCity,然后我可以在外部插件列表中看到该插件,它也被解压缩到 .BuildServer/plugins/.unpacked 但不是什么都没有发生。
插件似乎没有运行。 (我什至在任何日志文件中都没有看到插件名称)
我最简单的尝试是从 maven 原型创建一个插件:
mvn archetype:generate -DarchetypeRepository=http://download.jetbrains.com/teamcity-repository -DarchetypeArtifactId=teamcity-server-plugin -DarchetypeGroupId=org.jetbrains.teamcity.archetypes -DarchetypeVersion=RELEASE
然后只添加一些日志记录:
package com.example.plugin;
import jetbrains.buildServer.log.Loggers;
public class AppServer {
public void run() {
Loggers.SERVER.info("I'm running");
}
}
并使用 init 方法创建必要的 bean:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"
default-autowire="constructor">
<bean id="appServer" class="com.example.plugin.AppServer" init-method="run"/>
</beans>
我上传插件,重新启动 TeamCity,但来自 AppServer 的日志消息没有出现在任何日志文件中。
我错过了什么?如何记录此消息?
【问题讨论】: