Monday, May 12, 2014

What's wrong with Maven

In the project I have to work on mentioned in the last post, there are of course other technologies and tools used besides Hibernate that I have to learn (I do not come from a Java programming background so most of these are (though not conceptually) relatively new to me).
One of them is the buildtool Maven. Let’s see what flaws we can find with Maven:

  • It’s ironic how their philosophy is “don’t repeat yourself” yet they use xml for the configuration where up to half of the filesize comes from repeating words for the closing tags (yes I know that’s not what they mean).
  • They make users to define custom “properties” with custom tags. Within a pom.xml file you can write:

    <properties>
        <myfaces.version>2.1.12</myfaces.version>
        <mojarra.version>2.1.23</mojarra.version>
        <myweirdpropertythatiwillnotuse>42</myweirdpropertythatiwillnotuse>
    </properties>
    

    where myfaces.version etc. is the name of the property I want to define. Not only do I have to repeat myself here, but the notation is not even used consistently to refer to properties and their values. In settings.xml, for a check whether a property matches some value, you write

    <activation>
        <property>
            <name>target-env</name>
            <value>dev</value>
        </property>
    </activation>
    

    And we shall not forget that all the other tags used are static. I don’t even know how they got their dtd or xslt or whatever we have here to swallow this.

Btw: I have never liked and will never like xml for all its bloat and way too many ways to do things (with no visible benefits of one over the other): You can set data by:

  1. Using user defined tags.
  2. Using tag attributes.
  3. Using nested tags.
  4. Any weird combination thereof.

Also people don’t stick to one standard for writing lists of values. Sometimes they pack everything in an attribute value, leaving other programs to parse it (svg…), sometimes they go

    <activeProfiles>
        <activeProfile>alwaysActiveProfile</activeProfile>
        <activeProfile>anotherAlwaysActiveProfile</activeProfile>
    </activeProfiles>
    <repositories>
     <repository>
     </repository>
    </repositories>

repeating the outer word in singular in the inside, sometimes not:

  <properties>
    <tomcatPath>/path/to/tomcat/instance</tomcatPath>
  </properties>

Even worse, they sometimes even make use of the fact that <a>hi<br/>there</a> is parsed as one node with three children, two of them unnamed.


Proudly written with StackEdit.

No comments:

Post a Comment