diff --git a/build.xml b/build.xml
index 558765c6231018877b2f169483e4172027c3aebd..72c146c24e005d693de571e0c8f8a6c075e0aebd 100644
--- a/build.xml
+++ b/build.xml
@@ -52,7 +52,7 @@
 
   <!-- Report rule violations with PHPMD (mess detector) -->
   <target name="phpmd">
-    <exec command="phpmd ${srcdir}/module xml ${srcdir}/tests/phpmd.xml --exclude ${srcdir}/module/*/tests --reportfile ${builddir}/reports/phpmd.xml" />
+    <exec command="phpmd ${srcdir}/module xml ${srcdir}/tests/phpmd.xml --exclude ${srcdir}/module/VuFind/tests,${srcdir}/module/VuFindSearch/tests --reportfile ${builddir}/reports/phpmd.xml" />
   </target>
 
   <!-- Measure project with phploc -->