2016-12-07 177 views
0

爲Gosu語言添加了SonarQube 6.1自定義插件。 使用ANT構建工具完成構建。 但是,得到的異常添加自定義插件後無法啓動SonarQube

2016年12月7日19時42分36秒ERROR網站[] [oaccC [[[/]]異常發送上下文初始化事件監聽器類
org.sonar.server的實例.platform.web.PlatformServletContextListener java.lang.ClassCastException: org.sonarsource.plugins.gscan.GosuPlugin不能轉換到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> 
給出
+0

GosuPlugin是否實現了org.sonar.api.Plugin? (正如在這裏的文檔中所解釋的:http://docs.sonarqube.org/display/DEV/API+Basics) –

+0

這個插件是用一段時間內不支持的API構建的。 –

回答

0

此問題是由於標記中給出的錯誤信息造成的。項目根據新的清單細節重新配置。對於清單詳細信息檢查由maven build生成的.MF文件。