You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Fredy <so...@email.de> on 2006/02/01 10:50:08 UTC

[m2] Using the pom version in JavaCode

Hi all,
is there a library to access the pom Content from Java?
For example when I should show the actuall Version in the titleboard ore something else.

Fredy

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [m2] Using the pom version in JavaCode

Posted by Orjan Austvold <au...@colibria.com>.
Maven adds the pom.xml of war/jar artifacts to the archived file. You 
can retreive it on a running system by using somthing like

getClass().getResourceAsStream("/META-INF/maven/<groupId>/<artifactId>/pom.xml");


Ørjan


Fredy wrote:
> Hi all,
> is there a library to access the pom Content from Java?
> For example when I should show the actuall Version in the titleboard ore something else.
> 
> Fredy
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [m2] Using the pom version in JavaCode

Posted by jerome lacoste <je...@gmail.com>.
On 2/1/06, Fredy <so...@email.de> wrote:
> Hi all,
> is there a library to access the pom Content from Java?
> For example when I should show the actuall Version in the titleboard ore something else.

within a plugin you should get the org.apache.maven.model.Model
instance that represent your pom. This instance is hold within a
MavenProject instance, and you can retrieve it in your mojo by adding
the following property:

    /**
     * @parameter expression="${project.model}"
     */
    private Model pom;

This property will be filled up dynamically at run time.

Jerome

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org