@@ -231,12 +231,41 @@ then
231231 echo " ====================================================================="
232232 sed ' s;http://maven.apache.org/xsd/maven-4.0.0.xsd;https://maven.apache.org/xsd/maven-4.0.0.xsd;' pom.xml > pom.new &&
233233 mv -f pom.new pom.xml &&
234- git commit pom.xml \
235- -m ' POM: use HTTPS for schema location URL' \
234+ git commit pom.xml -m ' POM: use HTTPS for schema location URL' \
236235 -m ' Maven no longer supports plain HTTP for the schema location.' \
237236 -m ' And using HTTP now generates errors in Eclipse (and probably other IDEs).'
238237fi
239238
239+ # Check project xmlns, xmlns:xsi, and xsi:schemaLocation attributes.
240+ grep -q ' xmlns="http://maven.apache.org/POM/4.0.0"' pom.xml > /dev/null 2> /dev/null &&
241+ grep -q ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' pom.xml > /dev/null 2> /dev/null &&
242+ grep -q ' xsi:schemaLocation="http://maven.apache.org/POM/4.0.0\b"' pom.xml > /dev/null 2> /dev/null ||
243+ {
244+ echo " ====================================================================="
245+ echo " NOTE: Your POM's project attributes are incorrect. Fixing it now."
246+ echo " ====================================================================="
247+ sed ' s;xmlns="[^"]*";xmlns="http://maven.apache.org/POM/4.0.0";' pom.xml > pom.new &&
248+ mv -f pom.new pom.xml &&
249+ sed ' s;xmlns:xsi="[^"]*";xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";' pom.xml > pom.new &&
250+ mv -f pom.new pom.xml &&
251+ sed ' s;xsi:schemaLocation="[^"]*";xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd";' pom.xml > pom.new &&
252+ mv -f pom.new pom.xml &&
253+ git commit pom.xml -m ' POM: fix project attributes' \
254+ -m ' The XML schema for Maven POMs is located at:' \
255+ -m ' https://maven.apache.org/xsd/maven-4.0.0.xsd' \
256+ -m ' Its XML namespace is the string:' \
257+ -m ' http://maven.apache.org/POM/4.0.0' \
258+ -m ' So that exact string must be the value of xmlns. It must also
259+ match the first half of xsi:schemaLocation, which maps that
260+ namespace to an actual URL online where the schema resides.
261+ Otherwise, the document is not a Maven POM.' \
262+ -m ' Similarly, the xmlns:xsi attribute of an XML document declaring a
263+ particular schema should always use the string identifier:' \
264+ -m ' http://www.w3.org/2001/XMLSchema-instance' \
265+ -m " because that's the namespace identifier for instances of an XML schema." \
266+ -m " For details, see the specification at: https://www.w3.org/TR/xmlschema-1/"
267+ }
268+
240269# Change forum references from forum.image.net to forum.image.sc.
241270if grep -q ' https*://forum.imagej.net' pom.xml > /dev/null 2> /dev/null
242271then
0 commit comments