Le sam. 28 mars 2026 à 17:16, Mirko Friedenhagen <[email protected]> a écrit :
> Am 28.03.2026 um 16:40 schrieb Fabrice Bauzac <[email protected]>: > > My take on XSD is that it can be used by Maven to run a standard XML > > validator. However, it is optional; also, the schema URL may point to > > a local file in a random local directory. So I don't think it is a > > good idea for Maven to deduce anything from the schema URL, which may > > be present or absent or have different values. I think Maven should > > instead rely on <modelVersion> alone. And the XSD information should > > remain optional, so people who don't need it can remove it... > Here I would disagree: either use model version or XSD. Otherwise you may > have contradicting information. What I mean is that if we do not change the namespace (as I recommend), then we cannot count on the schemaLocation to determine the model version. #+begin_src xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-build-pom.xsd"> <artifactId>skube-java-sdk</artifactId> ... </project> #+end_src In the best case, if the pom.xml is written as above, then Maven can extract the schemaLocation (.xsd file) as being http://maven.apache.org/xsd/maven-build-pom.xsd, and from that URI Maven could indeed deduce that this is the new build pom format. However, the schemaLocation can indicate any URI. If we have: #+begin_src xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 file:///home/user/schema.xsd"> <artifactId>skube-java-sdk</artifactId> ... </project> #+end_src Then there is little hope that Maven can determine what is the format, short of having to analyze the actual contents of the .xsd file. Finally, as the schemaLocation is only a hint, it may not even be present: #+begin_src xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > <artifactId>skube-java-sdk</artifactId> ... </project> #+end_src So using the schemaLocation target xsd URI as *the* means for Maven to obtain the model version is brittle at best. I think Maven should only rely on the <modelVersion> element instead for that purpose. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
