添加自定义插件后无法启动 SonarQube

Unable to start the SonarQube after adding a custom plugin

为 Gosu 语言的 SonarQube 6.1 添加了自定义插件。 构建是使用 ANT 构建工具完成的。 但是得到异常

2016.12.07 19:42:36 ERROR web[][o.a.c.c.C.[.[.[/]] Exception sending context initialized event to listener instance of class
org.sonar.server.platform.web.PlatformServletContextListener java.lang.ClassCastException: org.sonarsource.plugins.gscan.GosuPlugin cannot be cast to org.sonar.api.Plugin

构建文件如下

<?xml version="1.0"?>
<project name="Gscan" default="buildJar">
    <property file="build.properties"/> 
    <property name="gscan.dir" value="${gscan.source}"/>  
    <property name="jar.name" value="sonar-gosu-plugin"/>
    <property name="lib.dir" value="${lib}"/>

    <path id="project.classpath">
    <fileset dir="${lib.dir}">
        <include name="**/*.jar" />
    </fileset>
    <pathelement path="${build.dir}"/>
    </path>

    <target name="clean">
        <delete dir="${build.dir}"/>            
        <delete dir="src" />
        <delete dir="${target.folder}\SonarPlugin" />
        <mkdir dir="${build.dir}"/>
        <mkdir dir="src"/>
        <mkdir dir="${target.folder}\SonarPlugin"/>
    </target>

    <target name="compile" depends="clean" description="compile the source">
    <javac classpathref="project.classpath" srcdir="${gscan.source}" destdir="${build.dir}" includeantruntime="false" debug="on">
    </javac>
     <copy file="${rules.from}/gscan-rules.xml" todir="${rules.to}"/>
     <copy file="${rules.from}/gscan_widget.html.erb" todir="${rules.to}"/>
     <copy file="${properties.from}/gscan.properties" todir="${properties.to}"/>
     <copy file="${properties.from}/gscan_fr.properties" todir="${properties.to}"/>
      <copy todir="${build.dir}/META-INF">
                <fileset dir="${gscan.source}/META-INF"/>
          </copy>
     <!--copy file="${gscan.source}/jsr305-1.3.9.jar" todir="${build.dir}"/-->
    </target>

    <target name="getSource" depends="clean">

          <copy todir="src">
                <fileset dir="${build.dir}"/>
          </copy>           
    </target>
    <target name="buildJar" depends="compile,getSource">
        <jar basedir="src" destfile="${target.folder}\SonarPlugin${jar.name}.jar">
        <manifest>
        <attribute name="Plugin-Dependencies" value="META-INF/lib/commons-lang-2.6.jar" />

        <attribute name="Plugin-Description" value="Analysis GOSU with CCAP Gosu plug-in " />

        <attribute name="Plugin-BuildDate" value="2016-12-07T12:45:26+0530" />

        <attribute name="Archiver-Version" value="Plexus Archiver" />

        <attribute name="Built-By" value="479848" />
        <attribute name="Plugin-Homepage" value="http://www.sonarqube.org/sonar-gosu-plugin/" />

        <attribute name="Plugin-License" value="GNU LGPL 3" />
        <attribute name="Plugin-Version" value="2.0" />

        <attribute name="Plugin-Organization" value="SonarSource" />
        <attribute name="Sonar-Version" value="6.1" />

        <attribute name="Plugin-IssueTrackerUrl" value="http://www.sonarqube.org/browse/SONAR" />
        <attribute name="Plugin-ChildFirstClassLoader" value="true" />

        <attribute name="Plugin-TermsConditionsUrl" value="" />
        <attribute name="Implementation-Build" value="0" />

        <attribute name="Plugin-OrganizationUrl" value="http://www.sonarqube.org" />
        <attribute name="Build-Time" value="2016-12-07T12:44:29+0530" />

        <attribute name="Plugin-Key" value="gosu" />
        <attribute name="Plugin-Class" value="org.sonarsource.plugins.gscan.GosuPlugin" />

        <attribute name="Build-Jdk" value="1.8.0_92" />
        <attribute name="Plugin-Name" value="sonar-gosu-plugin-2.0" />
        </manifest>
    </jar>
    </target>

</project>

此问题是由于标签中提供的详细信息不正确造成的。根据新清单重新配置项目 details.For 清单详细信息检查了 maven 构建生成的 .MF 文件。