adangel commented on code in PR #154:
URL: https://github.com/apache/maven-pmd-plugin/pull/154#discussion_r1635295738
##########
src/main/java/org/apache/maven/plugins/pmd/PmdReport.java:
##########
@@ -513,23 +513,11 @@ private String determineAuxClasspath() throws
MavenReportException {
resolvedArtifact.getArtifact().getFile().toString());
}
- List<String> projectClasspath = includeTests
- ? localProject.getTestClasspathElements()
- : localProject.getCompileClasspathElements();
-
- // Add the project's target folder first
- classpath.addAll(projectClasspath);
- if (!localProject.isExecutionRoot()) {
- for (String path : projectClasspath) {
- File pathFile = new File(path);
- String[] children = pathFile.list();
-
- if (!pathFile.exists() || (children != null &&
children.length == 0)) {
- getLog().warn("The project " +
localProject.getArtifactId()
- + " does not seem to be compiled. PMD
results might be inaccurate.");
Review Comment:
I added this warning back then, because users were configuring pmd plugin in
a multi-module project with `aggregate=true`, which has the following effect:
PMD is run on the parent project first, then the modules are built - which is
simply the wrong order. PMD needs to be run _after_ the project is build.
See my comment here:
https://issues.apache.org/jira/browse/MPMD-277?focusedCommentId=16814718&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16814718
If we remove the warning, we should also remove it from the FAQ:
https://github.com/apache/maven-pmd-plugin/blob/70fcdd048ca933253f374e3282e5af874a096aa5/src/site/fml/faq.fml#L102-L135
Maybe the warning should only be output, when the executed goal is `pmd`?
The problem is, users can run "mvn clean pmd:pmd" and get false
positives/negatives. Alternatively PMD could throw/report errors, if it doesn't
find any classes it needs during analysis. I think, currently we don't report
these.
On another note: the parameter `typeResolution` should probably be
deprecated as PMD doesn't make sense anymore without typeresolution. There was
a time, when this was a new feature and not widely used by rules, but today
most rules depend on that (and the feature is always enabled in PMD but doesn't
work correctly if the auxclasspath is not provided or empty).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]