Issue Details (XML | Word | Printable)

Key: MPPMD-14
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Carlos Sanchez
Reporter: Kenneth Leider
Votes: 4
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Maven 1.x PMD Plugin

PMD should run on unit tests

Created: 30/Sep/04 01:36 PM   Updated: 04/Aug/05 04:04 PM   Resolved: 04/Aug/05 04:04 PM
Return to search
Component/s: None
Affects Version/s: None
Fix Version/s: 1.7

Time Tracking:
Not Specified

File Attachments: 1. Text File plugin.jelly.patch (2 kB)
2. Zip Archive pmd-tests.zip (7 kB)



 Description  « Hide

Right now the only files under "pom.build.sourceDirectory" are checked. It would be nice is source under "pom.build.unitTestSourceDirectory" could be checked as well.



Sebastian Esponda added a comment - 13/Oct/04 11:21 AM

Right!...It would be nice. I've temporary edited plugin.jelly and duplicated the fileset section with:

<fileset dir="${pom.build.unitTestSourceDirectory}" ...
...

Regards!


Sebastian Esponda added a comment - 15/Oct/04 04:52 PM

This CVS patch will add a fileset including the tests (pom.build.unitTestSourceDirectory), only if the properties points to a valid directory.
Created editing version 1.15.

Regards,


Sebastian Esponda made changes - 15/Oct/04 04:52 PM
Field Original Value New Value
Attachment plugin.jelly.patch [ 13226 ]
Sebastian Esponda added a comment - 19/Oct/04 12:58 PM

We needed PMD to analyze our tests sources, so we did some changes:

Plugin.jelly:

If ${pom.build.unitTestSourceDirectory} points to a valid directory, a second fileset is included in pmd ant task.

Plugin.jsl:

The original file always used <a href="xref/... etc > when linking line numbers to sources. This failed for tests sources.
Now, if the file path starts with ${pom.build.unitTestSourceDirectory} the link will be <a href="xref-test/... etc >

In the zip file I’m including:

New plugin.jelly
New plugin.jsl
Patch for plugin.jelly 1.15 (Previously posted, included here for convenience)
Patch for plugin.jsl 1.4

... just in case you find it useful (hope so)
I’ve just learned jsl and jelly... so this is probably with bugs... but it’s working ok in our environment

Regards,


Sebastian Esponda made changes - 19/Oct/04 12:58 PM
Attachment pmd-tests.zip [ 13237 ]
Wim Deblauwe added a comment - 30/Mar/05 07:30 AM

Got the same problem, hopefully this makes it into the next release. Maybe we should have a property called 'maven.pmd.includetestdir' to tweak this behaviour.

You need something like this to do it:

<j:set var="addtestdir" value="${maven.pmd.includetestdir}"/>
<j:if test="${addtestdir == 'true'}">
<ant:echo>Including unit test directory: ${pom.build.unitTestSourceDirectory}</ant:echo>
<fileset dir="${pom.build.unitTestSourceDirectory}"/>
</j:if>


Carlos Sanchez added a comment - 04/Aug/05 04:04 PM

Fixed, but in a different way.

See property maven.pmd.check.tests


Carlos Sanchez made changes - 04/Aug/05 04:04 PM
Assignee Carlos Sanchez [ carlos ]
Status Open [ 1 ] Closed [ 6 ]
Fix Version/s 1.7 [ 11927 ]
Resolution Fixed [ 1 ]