Plugins 使用PropertyDefinition在sonarqube上添加属性
我有一个插件,其中一些属性是用Property类定义的,但我想对它们重新排序,所以我使用了PropertyDefinition类。问题在于Property类中有一个“project”字段,但PropertyDefinition中没有。当我使用PropertyDefinition运行它时,有0个设置。 这是前面的代码:Plugins 使用PropertyDefinition在sonarqube上添加属性,plugins,properties,sonarqube,Plugins,Properties,Sonarqube,我有一个插件,其中一些属性是用Property类定义的,但我想对它们重新排序,所以我使用了PropertyDefinition类。问题在于Property类中有一个“project”字段,但PropertyDefinition中没有。当我使用PropertyDefinition运行它时,有0个设置。 这是前面的代码: @Properties({ @Property(key = TestLinkPlugin.AAA, defaultValue = "false", name = "aa",
@Properties({
@Property(key = TestLinkPlugin.AAA, defaultValue = "false", name = "aa", description = "aa", project = true, type = PropertyType.BOOLEAN),...})
@Override
public void define(Context context) {
context.addExtensions(getExtensions());
}
以及新守则:
@Override
public void define(Context context) {
context.addExtension(
PropertyDefinition.builder(TestLinkPlugin.AAA)
.name("aa")
.description("aa")
.defaultValue("false")
.type(PropertyType.BOOLEAN)
.index(0)
.build()
);
...
}
提前感谢您的帮助我已找到解决方案,请添加以下内容:
.onQualifiers(Qualifiers.PROJECT)