【发布时间】:2017-12-05 15:31:33
【问题描述】:
我想在 Jenkins 中集成 Checkstyle 和 PMD 插件来自动检查代码质量。 我按照以下说明操作:http://www.treselle.com/blog/static-code-analysis-jenkins/
我在工作区中的 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>
我也添加了足够多的库,但是在构建 Jobs 的时候,出现了异常:
taskdef class com.puppycrawl.tools.checkstyle.CheckStyleTask cannot be found using the classloader AntClassLoader[]
为什么会出现这样的错误?以及如何正确整合它们?
非常感谢!
【问题讨论】:
标签: jenkins ant checkstyle pmd