You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jonas Olsson <Jo...@cambio.se> on 2006/11/09 13:51:16 UTC

Creating MavenProject within plugin

Hi!

This could be a no-no, but can I create a MavenProject object from a POM
(other than the one executed) within my plugin?
I've traversed the JavaDocs, but there is no obvious way (all methods
require arguments I cannot provide, e.g. ProfileManager).

/jonas
****************************************************************************
Detta e-mail har blivit unders�kt av http://www.virus112.se
****************************************************************************

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


Re: Creating MavenProject within plugin

Posted by franz see <fr...@gmail.com>.
Good day to you, Jonas,

The way I see it, you have 4 choices here:
1. Instantiate a MavenProject and set all properties you need from it.
2. Use MavenProjectStub (but this is for testing only as Maria has
indicated)
3. Do something like:

    /**
     * The maven project.
     *
     * @parameter expression="${project}"
     * @readonly
     */
    protected MavenProject project;

    And this will get your current project

4. Do this

    /**
     * Project builder
     *
     * @component
     */
    protected MavenProjectBuilder mavenProjectBuilder;

And use mavenProjectBuilder to build a MavenProject.

Cheers, 
Franz


Maria Odea Ching wrote:
> 
> Hi Jonas,
> 
> There's a MavenProjectStub class available in the 
> maven-plugin-testing-harness if you're interested. But
> its basically used for plugin testing. I'm not sure if it would be 
> useful for you, but you can take a look at it here:
> http://svn.apache.org/repos/asf/maven/shared/trunk/maven-plugin-testing-harness
> 
> Hope this helps! :-)
> 
> Thanks,
> Deng
> 
> Jonas Olsson wrote:
> 
>>Hi!
>>
>>This could be a no-no, but can I create a MavenProject object from a POM
>>(other than the one executed) within my plugin?
>>I've traversed the JavaDocs, but there is no obvious way (all methods
>>require arguments I cannot provide, e.g. ProfileManager).
>>
>>/jonas
>>****************************************************************************
>>Detta e-mail har blivit undersökt av http://www.virus112.se
>>****************************************************************************
>>
>>---------------------------------------------------------------------
>>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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Creating-MavenProject-within-plugin-tf2601500s177.html#a7275985
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Creating MavenProject within plugin

Posted by Maria Odea Ching <oc...@mergere.com>.
Hi Jonas,

There's a MavenProjectStub class available in the 
maven-plugin-testing-harness if you're interested. But
its basically used for plugin testing. I'm not sure if it would be 
useful for you, but you can take a look at it here:
http://svn.apache.org/repos/asf/maven/shared/trunk/maven-plugin-testing-harness

Hope this helps! :-)

Thanks,
Deng

Jonas Olsson wrote:

>Hi!
>
>This could be a no-no, but can I create a MavenProject object from a POM
>(other than the one executed) within my plugin?
>I've traversed the JavaDocs, but there is no obvious way (all methods
>require arguments I cannot provide, e.g. ProfileManager).
>
>/jonas
>****************************************************************************
>Detta e-mail har blivit undersökt av http://www.virus112.se
>****************************************************************************
>
>---------------------------------------------------------------------
>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