You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Sessizlik <ce...@gmail.com> on 2010/05/20 13:31:15 UTC

Mojo & Command Line Properties

Hi,

How can I access command line properties via a Mojo SubClass.

Now I had this:

   /** @parameter default-value="${project}" */
   private MavenProject mavenProject;


However when I tried to get properties via mavenProject.getProperties(), I
can not access command line properties that I passed.

Any help?

Thanks

-- 
View this message in context: http://old.nabble.com/Mojo---Command-Line-Properties-tp28619934p28619934.html
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: Mojo & Command Line Properties

Posted by Stephen Connolly <st...@gmail.com>.
The point is that if your mojo is invoked from an IDE (i.e. using maven
embedded) then the equivalent of command line properties will only be
available from MavenSession and you mojo will be broken if you use
System.getProperties to get them.

So it's not just better to use MavenSession, but it is the ___only correct
way___

-Stephen

On 21 May 2010 08:38, Sessizlik <ce...@gmail.com> wrote:

>
> Hi Olivier,
>
> It returned same data as System.getProperties() . But I think that this is
> better in terms of maven perspective.
>
> Thanks
>
>
>
> Olivier Lamy wrote:
> >
> > Hi,
> > Try with
> >
> > /**
> >  * The Maven Session Object
> >  *
> >  * @parameter expression="${session}"
> >  * @required
> >  * @readonly
> >  */
> >  protected MavenSession session;
> >
> > session.getExecutionProperties()
> >
> > 2010/5/20 Sessizlik <ce...@gmail.com>:
> >>
> >> Hi,
> >>
> >> How can I access command line properties via a Mojo SubClass.
> >>
> >> Now I had this:
> >>
> >>   /** @parameter default-value="${project}" */
> >>   private MavenProject mavenProject;
> >>
> >>
> >> However when I tried to get properties via mavenProject.getProperties(),
> >> I
> >> can not access command line properties that I passed.
> >>
> >> Any help?
> >>
> >> Thanks
> >>
> >> --
> >> View this message in context:
> >>
> http://old.nabble.com/Mojo---Command-Line-Properties-tp28619934p28619934.html
> >> 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
> >>
> >>
> >
> >
> >
> > --
> > Olivier
> > http://twitter.com/olamy
> > http://fr.linkedin.com/in/olamy
> > http://www.viadeo.com/fr/profile/olivier.lamy7
> >
> > ---------------------------------------------------------------------
> > 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://old.nabble.com/Mojo---Command-Line-Properties-tp28619934p28630618.html
> 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: Mojo & Command Line Properties

Posted by Sessizlik <ce...@gmail.com>.
Hi Olivier,

It returned same data as System.getProperties() . But I think that this is
better in terms of maven perspective. 

Thanks



Olivier Lamy wrote:
> 
> Hi,
> Try with
> 
> /**
>  * The Maven Session Object
>  *
>  * @parameter expression="${session}"
>  * @required
>  * @readonly
>  */
>  protected MavenSession session;
> 
> session.getExecutionProperties()
> 
> 2010/5/20 Sessizlik <ce...@gmail.com>:
>>
>> Hi,
>>
>> How can I access command line properties via a Mojo SubClass.
>>
>> Now I had this:
>>
>>   /** @parameter default-value="${project}" */
>>   private MavenProject mavenProject;
>>
>>
>> However when I tried to get properties via mavenProject.getProperties(),
>> I
>> can not access command line properties that I passed.
>>
>> Any help?
>>
>> Thanks
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Mojo---Command-Line-Properties-tp28619934p28619934.html
>> 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
>>
>>
> 
> 
> 
> -- 
> Olivier
> http://twitter.com/olamy
> http://fr.linkedin.com/in/olamy
> http://www.viadeo.com/fr/profile/olivier.lamy7
> 
> ---------------------------------------------------------------------
> 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://old.nabble.com/Mojo---Command-Line-Properties-tp28619934p28630618.html
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: Mojo & Command Line Properties

Posted by Olivier Lamy <ol...@apache.org>.
Hi,
Try with

/**
 * The Maven Session Object
 *
 * @parameter expression="${session}"
 * @required
 * @readonly
 */
 protected MavenSession session;

session.getExecutionProperties()

2010/5/20 Sessizlik <ce...@gmail.com>:
>
> Hi,
>
> How can I access command line properties via a Mojo SubClass.
>
> Now I had this:
>
>   /** @parameter default-value="${project}" */
>   private MavenProject mavenProject;
>
>
> However when I tried to get properties via mavenProject.getProperties(), I
> can not access command line properties that I passed.
>
> Any help?
>
> Thanks
>
> --
> View this message in context: http://old.nabble.com/Mojo---Command-Line-Properties-tp28619934p28619934.html
> 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
>
>



-- 
Olivier
http://twitter.com/olamy
http://fr.linkedin.com/in/olamy
http://www.viadeo.com/fr/profile/olivier.lamy7

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


Re: Mojo & Command Line Properties

Posted by Sessizlik <ce...@gmail.com>.
I thought that I could not be here but It was at here:

System.getProperties()

Thanks
-- 
View this message in context: http://old.nabble.com/Mojo---Command-Line-Properties-tp28619934p28621731.html
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