ServerBuildListener can't find build feature.
I wrote the plugin which set custom labels to jira issue after build successfully finished.
Here my Feature class
public class TeamcityToJiraBuildFeature extends BuildFeature implements TJPConstants {
public static final String FEATURE_TYPE = "gubber-teamcity-to-jira-plugin";
private final String myEditUrl;
public TeamcityToJiraBuildFeature(@NotNull final PluginDescriptor descriptor) {
myEditUrl = descriptor.getPluginResourcesPath("jiraNotificationSettings.jsp");
}
@NotNull
@Override
public String getType() {
return FEATURE_TYPE;
}
@NotNull
@Override
public String getDisplayName() {
return "Teamcity to jira notification plugin";
}
@Nullable
@Override
public String getEditParametersUrl() {
return myEditUrl;
}
@Override
public PlaceToShow getPlaceToShow() {
return super.getPlaceToShow();
}
@Override
public boolean isMultipleFeaturesPerBuildTypeAllowed() {
return false;
}
}
Here my BuildServerListener class
...
@Override
public void buildFinished(@NotNull SRunningBuild build) {
Collection<Issue> relatedIssues = collectIssues(build);
JiraLabelSetterContext context = JiraLabelSetterContext.initializeFromFeatureDescriptor(build, propertiesExtractor, propertiesToLabelEvaluator);
if (context == null) {
logger.info("Jira teamcity connector finished. Context wasn't initialized.");
}
...
}
...
And couple code strings of JiraLabelSetterContext
public static JiraLabelSetterContext initializeFromFeatureDescriptor(SRunningBuild build,
PropertiesExtractor propertiesExtractor, PropertiesToLabelEvaluator labelEvaluator) {
Collection<SBuildFeatureDescriptor> buildFeatures = build.getBuildFeaturesOfType(TeamcityToJiraBuildFeature.FEATURE_TYPE);
if (buildFeatures.size() == 0) {
logger.debug("Jira teamcity connector stops. There is no feature for build =" + build.getBuildNumber());
return null;
}
....
}
When build is successfully finished I read in logs "Jira teamcity connector stops. There is no feature for build =".
Everything was alright while I haven't write the second version of plugin. How can I understand why build feature hasn't been found?
Please sign in to leave a comment.
I'd check teamcity-server.log that your plugin loads without errors and that build configuration has the feature of the necessary type at the moment of build stating (check .../app/rest/buildTypes/id:<build configuration ID> and if build has custom settings: <TeamCity Data Directory>\system\artifacts\<Project ID>\<config name>\<build id >\.teamcity\settings\buildSettings.xml )