我想在Jenkins中集成Checkstyle和PMD插件以自動檢查質量代碼。 我跟着指示來自:http://www.treselle.com/blog/static-code-analysis-jenkins/如何在Jenkins中集成Ant與Checkstyle和PMD插件
我在工作區中的build.xml附在這些代碼:
<taskdef name="checkstyle" classpath="WEB-INF/libs/checkstyle-5.6.jar" classname="com.puppycrawl.tools.checkstyle.CheckStyleTask" />
<target name="checkstyle" description="Generates a report of code convention violations.">
<checkstyle config="sun_checks.xml" failOnViolation="false">
<formatter type="xml" tofile="checkstyle_report.xml" />
<fileset dir="WEB-INF/src" includes="**/*.java" />
</checkstyle>
</target>
<taskdef name="pmd" classpath="WEB-INF/libs/pmd.jar" classname="net.sourceforge.pmd.ant.PMDTask" />
<target name="pmd" depends="compress">
<pmd rulesetfiles="java-imports">
<formatter type="xml" toFile="pmd_report.x.ml" />
<fileset dir="WEB-INF/src">
<include name="**/*.java" />
</fileset>
</pmd>
</target>
我還添加了足夠的圖書館,但是當我建造工作,我有一個例外:
taskdef class com.puppycrawl.tools.checkstyle.CheckStyleTask cannot be found using the classloader AntClassLoader[]
爲什麼會出現這樣的錯誤?我如何正確整合它們?
非常感謝!