配置ANT以运行Lint4J

时间:2015-02-19 19:01:50

标签: java ant continuous-integration travis-ci jslint4java

我有一个github仓库,运行Java和JUnit,我也想运行lint4j。我的项目建立在travis-ci上。

但是,lint失败了:

BUILD FAILED
/home/travis/build/jvoller/SPDDB/build.xml:39: Problem: failed to create task or type lint4j
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place. 

我的ANT脚本出了什么问题?

  <target name="lint" description="runs lint4j on source files" >
    <mkdir dir = "tmp" />
      <lint4j sourcepath="src"
        classpath="lib/junit-4.11.jar"
        packages="${main.src.dir}.*"
        level="5"
        exact="false" >
      <formatters>
        <formatter type="text" />
        <formatter type="text" toFile="tmp/lint.out"/>
      </formatters> 
    </lint4j>
  </target>

1 个答案:

答案 0 :(得分:1)

必须定义lint4j任务。

<taskdef name="lint4j" classname="com.jutils.lint4j.ant.Lint4jAntTask">
  <classpath><pathelement location="lib/lint4j.jar"/></classpath>
</taskdef>

并且lint4j.jar必须可用。