【发布时间】:2013-08-27 20:40:16
【问题描述】:
我编写了一个新的 checkstyle 检查作为文件扫描器。我按照我在 checkstyle 代码中找到的代码对我的 junits 进行了建模。 junit 运行良好,一切看起来都很好。
然后,我将支票添加到我的项目中。
<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运行它时,当它们都在同一个jar文件中时,ant找到了检查类,但找不到支持类。这就是我在蚂蚁中得到的东西
[checkstyle] [class]:0: Got an exception - java.lang.NoClassDefFoundError: com/onuspride/codetools/common/classpath/criteria/ClassNameCriteriaCollector
我很难过。我检查了我的 jar 的所有依赖项,它们都在类路径中,我不明白它如何在同一个 jar 中找到一个类文件而不是另一个类文件。我已经做了所有肮脏的小把戏,我就是不明白。
有什么想法吗?
【问题讨论】:
-
我不明白它如何在同一个 jar 中找到一个类文件而不是另一个类文件 :: 你能告诉你找到了哪个类,没有找到哪个类,在什么jar文件下。
-
校验类是com.onuspride.codetools.checkstyles.DuplicateClassNames,找不到的类是,它们都包含在同一个jar中。 com.onuspride.codetools.common.classpath.criteria.ClassNameCriteriaCollector
标签: checkstyle