关于正则表达式:仅在Unix上出现Checkstyle错误

Checkstyle error on Unix only

我正在使用Ant为* /。html文件运行基于自定义正则表达式的checkstlye。这是非常简单的配置。
antbuild.xml:

1
2
3
4
5
6
7
8
<taskdef resource="checkstyletask.properties" classpath="checkstyle-5.5-all.jar"/>
<target name="check">
    <checkstyle config="checks.xml" failOnViolation="false">
        <fileset dir="${basedir}" includes="**/*.html"/>
        <formatter type="plain"/>
        <formatter type="xml" toFile="${basedir}/reports/checkstyle-report.xml"/>
    </checkstyle>
</target>

checks.xml:

1
2
3
4
5
6
<module name="Checker">
    <property name="charset" value="UTF-8"/>
    <module name="RegexpMultiline">
        <property name="format" value="\\A.+<table>.+<\\/table>.+\\Z"/>
    </module>
</module>

在Windows 7 64位上:

1
2
3
Apache Ant(TM) version 1.8.3 compiled on February 26 2012,
BUILD SUCCESSFUL
Total time: 1 second

在CentOS 64位上:

1
2
3
Apache Ant(TM) version 1.8.2 compiled on May 13 2011,
BUILD FAILED
build.xml:8: Unable to create a Checker: cannot initialize module RegexpMultiline - Unable to instantiate RegexpMultiline

有人可以提出建议吗?

谢谢,


好吧,因此只需运行ant -v即可显示以下内容:

1
2
3
4
parsing buildfile jar:file:/usr/share/java/ant-1.8.2.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/usr/share/java/ant-1.8.2.jar!/org/apache/tools/ant/antlib.xml from a zip file
...
[checkstyle] checkstyle version 4.4
[checkstyle] compiled on Mon December 06 2010, 21:35 GMT

所以失败的原因与操作系统无关,与版本有关