Wouter, thanks for posting your suggestion here! Do any of the other devs here have any input? Is this useful? Should it be included in some other plugin or does it call for a separate plugin? Maybe as a utility goal of the templating plugin?
/Anders On Thu, May 23, 2013 at 2:39 PM, Wouter <wowt...@gmail.com> wrote: > Hi, > > I have written a plugin and I was wondering if you think it's of any > use, and if so, if it could be part of the Mojo project. > > The goal of the plugin is to make POM properties accessible from Java > code. It generates a Java class with some constants whose values are > defined in pom.xml. I call it the Project Info plugin. Example > generated class: > > public class ProjectInfo > { > public static final String title = "My Title"; > > public String getTitle() { > return title; > } > } > > Example POM configuration: > > <configuration> > <properties> > <title>${project.name}</title> > </properties> > </configuration> > > There are more features, but this shows the core of it. > > Why such a plugin? The effect (accessing POM properties from Java) can > also be achieved via resource > filtering[ > http://blog.nigelsim.org/2011/08/31/programmatically-getting-the-maven-version-of-your-project/ > ]. > These are, in my opinion, the most significant advantages of either > method. > > Advantages of the resource filtering method: > > * project requires no additional dependencies > > Advantages of using the plugin: > > * most of the work (and error checking) is done at build time, rather > than run time; this is safer and more resource efficient > > * reduces the amount of boiler plate code; project specific Java code > is generated, the author only writes a plugin configuration in the POM > > Any comments would be appreciated! > > Best regards, > Wouter > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > >