0

filescanner として新しい checkstyle チェックを書きました。私は、checkstyle コードで見つけたコードに従って、junit をモデル化しました。junits は正常に動作し、すべてが良好に見えます。

しかし、その後、プロジェクトにチェックを追加します。

<module name="TreeWalker">
    <property name="tabWidth" value="4" />

    <module name="com.onuspride.codetools.checkstyles.DuplicateClassNames"/>
</module>

そして私の蟻の仕事

<taskdef resource="checkstyletask.properties">
    <classpath refid="classpath" />
</taskdef>

<property name="checkstyle.suppressions.file" value="checkstyle/suppressions.xml" />
<property name="translation.severity" value="error" />

<target name="checkStyle" description="TestTask to evaluate the checkstyle system.">
    <checkstyle config="checkstyle/checkstyle_checks.xml">
        <fileset dir="${msg.src}" includes="**/*.java" />
        <formatter type="plain" />
        <formatter type="xml" toFile="${msg.build.jar}/checkstyle_errors.xml" />
        <classpath refid="classpath" />
    </checkstyle>
</target>

duplicateclassnames クラスは、同じ jar 内の複数のクラスを呼び出します。何らかの理由で、ant がそれを実行すると、ant はチェック クラスを見つけますが、それらがすべて同じ jar ファイルにある場合、サポート クラスを見つけることができません。これが私がantで得たものです

  [checkstyle] [class]:0: Got an exception - java.lang.NoClassDefFoundError: com/onuspride/codetools/common/classpath/criteria/ClassNameCriteriaCollector

私は困惑しています。私のjarのすべての依存関係をチェックしました.それらはすべてクラスパスにあります.1つのクラスファイルを見つける方法がわかりませんが、同じjar内の別のクラスファイルは見つかりません. 私は汚い小さなトリックをすべてやりましたが、それがわかりません。

何か案は?

4

1 に答える 1