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]>:
> > The problem if you change the namespace, is that certain tools that
> > are currently tuned and working well with {MavenModel4.0.0}dependency
> > will need changes when told to work on a different element like
> > {MavenModel4.1.0}dependency.  That seems like unnecessary breakage,
> > burden and additional work to me, especially if you want 4.0.0 and
> > 4.1.0 to have the same general structure...
> Hi,
>
> I would think this is an advantage. They are basically not the same though 
> they look similar.
> Theoretically 4.2.x could finally use a shortened dependency definition, 
> which seems to be one of the major things people find ugly compared to e.g. 
> gradle.

You can change parts of the structure indeed, e.g. instead of

#+begin_src xml
  <dependency>
    <groupId>g</groupId>
    <artifactId>a</artifactId>
    <version>v</version>
  </dependency>
#+end_src

have

#+begin_src xml
  <dependency>g:a:v</dependency>
#+end_src

Which is fine.  But please note that doing so does not require a
change of namespace.

What I mean is that given the age of Maven, there are probably many
scripts and tools that use an XML library to look for information, for
example if I want to look for the name of a project in a Python script:

#+begin_src python
  #!/usr/bin/python3

  import xml.etree.ElementTree as ET

  tree = ET.parse('pom.xml')
  project_element = tree.getroot()
  namespace = "http://maven.apache.org/POM/4.0.0";
  name_element = "{"+namespace+"}name"
  print(project_element.findall("./"+name_element)[0].text)
#+end_src

I suspect there are many small or bigger programs like this floating
around.

Changing the namespace to http://maven.apache.org/POM/4.1.0 would
break all such existing programs...

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to