Maven now supports attributes in pom.xml?!
In December 2005, I asked Is it possible to make pom.xml simpler?.
After seeing what the Spring Developers have done to simplify Spring context files, I can't help but think the same thing is possible for Maven 2's pom.xml. Is it possible to add namespaces and make something like the following possible?
Before:
<dependency> <groupId>springframework</groupId> <artifactId>spring</artifactId> <version>1.2.6</version> </dependency>
After:
<dep:artifact name="org/springframework/spring" version="1.2.6"/>
Or just allow attributes to make things a bit cleaner?
<dependency groupId="org.springframework" artifactId="spring" version="1.2.6"/>
At that time, the general response was "That's how Maven works. It's a matter of taste. You'll get used to it." It's been two years and sure, I'm used to it, but I'd still rather write less XML. That's why I was particularly pleased to see Brett Porter's write Maven now supports condensed POMs using attributes:
The issue is being tracked under MNG-3397.
The result is that something like this:
<dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupId>easymock</groupId> <artifactId>easymock</artifactId> <version>1.2_Java1.3</version> <scope>test</scope> </dependency> ...
Halves in length to something like this:
<dependency groupId="junit" artifactId="junit" version="3.8.1" scope="test"/> <dependency groupId="easymock" artifactId="easymock" version="1.2_Java1.3" scope="test"/> ...
Now that wasn't so hard was it?
Posted by Ben on February 11, 2008 at 11:22 PM MST #
Posted by GB on February 12, 2008 at 12:17 AM MST #
Posted by Matt Raible on February 12, 2008 at 12:29 AM MST #
Posted by Brett Porter on February 12, 2008 at 05:55 AM MST #