|
[Maven]
The POM and the importance of project metadata
[
jvanzyl
]
If you're a user of Maven then you are familiar with the Project Object Model (POM) which is the basic unit of work in Maven. Maven is a project-centric tool and so we attempt to capture the essence of a project in the POM. This includes things like what your project is, where the project lives, where you can find the sources for project, who the developers are on the project and how you can get hold of them, what you need to build the project, the way your project will be built, what form your project will be distributed in, and where it will be distributed from. By way of the POM, Maven gives users an easy way to describe, in a uniform way, all their projects. Once you know how to work with one Maven project you know how to work with them all whether they be projects of your own, projects within your own organization, or OSS project's that use Maven. Encapsulating project information in the POM allows you to to quickly get a project's build up and running which let's you focus on the project's code which is where a project's value resides. Once you get a basic project's build working then you can turn to some of the more interesting features like the many report plugins and site generation. These are the tools that let you convey to others what your project is all about. The site is generated in a uniform way which means familiartity with one Maven site means you can easily navigate any Maven site. This is key for project comprehension. Many of these features are pretty good in Maven 1.x but we are working very hard on Maven 2.x to improve the comprehension features of Maven including a revamped site generation mechanism and a new Reporting API. We hope to encourage the use Maven's standard way of doing things and the use of the POM in general. Our first attempt at this is the release of our Ant tasks for general artifact handling. Brett made Ant task wrappers for our maven-artifact package and released it this morning. We hope this will facilitate the use of Maven's general artifact handling mechanism but more importantly promote the use of our rich body of project metadata. At last count we had approximately 8600 artifacts in the repository most of which we have valid POMs for. That is an incredibly valuable resource. Many exciting things will emerge as a result of our work in Maven 2.x to inprove the general state of the Maven repository. We have developed a pretty comprehensive tool for converting and validating Maven repositories and so the information we can provide on projects will utlimately carry a great deal of value. It was good to see the Ant tasks for dependency management. What would get me REALLY excited is an Ant task for accessing the metadata stored in the POM. It's hard to drive an Ant-based build process off a POM unless the data in the POM is as easy as ${pom.blah}. The tricky parts come into play where the POM has collections (for example, ), but I don't think the hurdles are insurmountable. Fortunately it sounds like this is the direction (encouraging increased use of the POM across build tools) you guys are heading--keep up the good work. --Kyle Adams, April 25, 2005 06:58 PM
Kyle, you might like to check out Ant's XmlProperty task. If you were to point it at the POM file, you would be able to access the data with in it with references such as ${pom.blah}. From the Ant online docs: Loads property values from a well-formed xml file. There are no other restrictions than "well-formed". You can choose the layout you want. For example this XML property file: is roughly equivalent to this Java property file: root.properties.foo = bar --Brendon Matheson, July 4, 2005 01:42 AM
Post a comment
|