- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
<?xml version="1.0" encoding="UTF-8"?>
<project name="Example" default="pmd" basedir=".">
<property name="PMD.home" location="D:\Software\Java\pmd-4.2.5"/>
<path id="PMD.lib">
<fileset dir="${PMD.home}\lib">
<include name="*.jar" />
</fileset>
<!--pathelement location="${PMD.home}/lib/jaxen-1.1.1.jar" -->
</path>
<echo>${PMD.home}\lib</echo>
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" >
<classpath refid="PMD.lib" />
</taskdef>
<target name="pmd">
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="PMD.lib" />
<echo>${PMD.home}\bin\pmd-rules.xml</echo>
<pmd>
<ruleset>${PMD.home}\bin\pmd-rules.xml</ruleset>
<formatter type="html" toFile="pmd_report_ant9.html" />
<fileset dir="C:\Documents and Settings\twarsi\eclipse3_5\tw1\Example">
<include name="**\*.java"/>
</fileset>
</pmd>
</target>
</project>
我正在尝试运行上面的 ant 脚本来执行 PMD 规则集 pmd-rules.xml,但出现以下错误。
pmd:
[echo] D:\Software\Java\pmd-4.2.5\bin\pmd-rules.xml
[pmd] Using the normal ClassLoader
[pmd] Adding classpath entry: <D:\Software\Java\pmd-4.2.5\bin>
[pmd] Sending a report to file = D:\Software\Java\pmd-4.2.5\bin\pmd_report
_ant9.html; renderer = html
BUILD FAILED
java.lang.NoClassDefFoundError: org/jaxen/JaxenException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getConstructor0(Class.java:2699)
at java.lang.Class.newInstance0(Class.java:326)
at java.lang.Class.newInstance(Class.java:308)
at net.sourceforge.pmd.RuleSetFactory.parseSingleRuleNode(RuleSetFactory
.java:309)
at net.sourceforge.pmd.RuleSetFactory.parseRuleNode(RuleSetFactory.java:
253)
at net.sourceforge.pmd.RuleSetFactory.parseRuleSetNode(RuleSetFactory.ja
va:209)
at net.sourceforge.pmd.RuleSetFactory.createSingleRuleSet(RuleSetFactory
.java:135)
at net.sourceforge.pmd.RuleSetFactory.createRuleSets(RuleSetFactory.java
:85)
at net.sourceforge.pmd.ant.PMDTask.doTask(PMDTask.java:220)
at net.sourceforge.pmd.ant.PMDTask.execute(PMDTask.java:334)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.Main.runBuild(Main.java:758)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
你能告诉我我遗漏了什么吗?甚至 jaxen-1.1.1.jar 都在 lib 目录中。但它显示错误。我是否在 ant 脚本中遗漏了一些东西。
最佳答案
将pmd.home\lib 中的所有文件复制到ant.home\lib 文件夹
pmd.home 是您的 pmd 目录:在您的例子中:D:\Software\Java\pmd-4.2.5ant.home 是您的 ant 主目录:假设您使用的是 netbeans,它将是 netbeans\java\ant
注意重复的 jar 或重复的版本(尤其是 ant)。
然后,再次运行命令。希望对您有所帮助。
关于java - Pmd ant 脚本给出 java.lang.NoClassDefFoundError : org/jaxen/JaxenException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7487111/
我的 build.gradle 中有 PMD 检查,如下所示: apply plugin: "pmd" dependencies { pmd "net.sourceforge.pmd:pmd-ja
我正在阅读一个有趣的教程:http://www.avajava.com/tutorials/lessons/how-do-i-generate-pmd-and-cpd-reports-for-a-si
我想知道是否有办法从命令行运行所有 PMD 规则集。 我使用了与 Eclipse IDE 和 Maven 集成的 PMD。但现在我需要从 CLI 运行它。 我已经检查过这个页面 http://pmd.
我正在修改我的应用程序代码以遵守 pmd 规则。我在这段代码中有一个关闭资源错误: Connection c = DataSourceUtils.getConnection(dataSource);
是否有工具或插件来跟踪每个开发人员的 PMD、CheckStyle 和 Findbugs 不合规报告 谢谢韩国 最佳答案 似乎Sonar是你需要的 Sonar is an open source qu
我想在 PMD 中使用自定义规则。我在 jenkins 中安装了 PMD 插件,我还创建了一个 jar: 规则集文件 自定义规则的java代码(自定义规则扩展自AbstractJavaRule)。 我
http://maven.apache.org/plugins/maven-pmd-plugin/目前版本为 2.4,支持 PMD 版本 4.2.2 是否可以将 PMD 版本 4.2.5 与此插件一起
我们如何在 eclipse pmd 插件中添加新的基于 java 的 pmd 规则? 我收到以下错误: 无效的类实现。类必须在插件类路径中并实现规则接口(interface)。 我用 Abstract
我在 Jenkins 上使用 Sonar 的 PMD 插件对我的代码进行静态分析。我也在运行 Eclipse 的 PMD 插件(准确地说是 eclipse-pmd 1.5 ( http://marke
我想通过永久链接使用我的 Sonar PMD 配置, 这是我的 maven pom.xml 的构建部分 install org.apach
我们的 Jenkins 实例中有许多 Maven 作业,每个作业都有自己特定的调用字符串,在构建配置中指定,类似于 mvn clean install -DDISABLED="javadoc:aggr
PMD和SonarQube是一个很好的工具,但是我在抑制PMD警告时遇到了问题。 我们在项目中经常使用Lombok,因此许多模型类都有: @SuppressWarnings(“PMD.UnusedPr
也许只有我一个人,但是我找不到PMD中具有最高优先级的信息: 1 或 5 吗? 由于http://pmd.sourceforge.net/running.html和命令行参数-minimumprior
是否有很好的资源来描述 PMD 规则集背后的“原因”? PMD's site有“什么”——每条规则的作用——但它没有描述为什么 PMD 有这条规则,以及为什么忽略这条规则会给你在现实世界中带来麻烦。特
我用声纳开始了我的冒险;) 声纳的默认配置在主要级别设置了 PMD UnnecessaryLocalBeforeReturn 错误。 List filtered = em.createQuer
我正在尝试微调我们的 CI,但我无法弄清楚如何避免 PMD 在 src-gen 中报告生成代码的违规行为(不讨论那里的 Android R 文件): 我使用 mvn help:effective-po
我想在我的gradle项目中设置PMD,使其具有两个规则集,一个规则集是强制性的,可以中断构建,而另一个规则集只是报告但可以继续构建。这可能吗? 最佳答案 绝对有可能! 默认情况下,PMD插件将为每个
我在 Windows 上的 Eclipse 中使用 pmd 时出现严重的内存泄漏。我导入了一堆大型 Maven 项目。 m2e 和编译后 PMD 启动。然后,它最终在工作区中的许多(大约 50 个)项
如何定义 custom-rulesets.xml在父项目中,所以它在子模块中被重用? 我有一个运行良好的 PMD 示例项目 ( you can check later )。 但是,这个 Maven 项
我正在创建一个基于 maven 的 java 项目,其中包含 PMD maven 插件。我使用我自己的规则集 XML,它的工作原理就像一个魅力,除了两个规则集:emptycode 和 unnecess
我是一名优秀的程序员,十分优秀!