添加了Sonarqube 6.1的自定义插件,用于GOSU语言。使用蚂蚁构建工具完成构建。但是得到例外
2016.12.07 19:42:36错误web [] [O.A.C.C.C. [。 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>
此问题是由于标签中给出的不正确细节所致。根据新的清单细节重新配置项目。为清单详细信息检查了Maven Build生成的.MF文件。