As noted by Neeme there seems to be no solution to this problem.
However I have written a Groovy script that you can have Maven call (GMaven) to check for possible XHTML tags that will get self closed.
This script probably needs better error messages and does not handle all cases but has so far mitigated the problem.
#!/usr/bin/env groovy
def srcdir = project.properties['srcdir'];
def badFiles = [];
def checkFile(badFiles, file) {
def htmlLines = file.readLines();
def found = [];
int i = 0;
for (html in htmlLines) {
++i;
//print html;
def m = html =~ /<(\w+)[^>]*?><\/(\w+)>/
def bad = m.findAll { it[1] == it[2] };
if (bad)
found.add(['bad' : bad, 'line' : i]);
}
if (found) {
badFiles << file;
println "File had bad HTML: " + file.canonicalPath;
println found;
}
}
def ant = new AntBuilder();
scanner = ant.fileScanner {
fileset(dir:srcdir) {
include(name:"**/*.jspx")
}
}
for (f in scanner) {
//println "Checking file: " + f.canonicalPath;
checkFile(badFiles, f);
}
if (badFiles) {
println "Bad files: " + badFiles;
fail('Bad files: ' + badFiles);
}