You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Samuel Gaspari <sa...@gmail.com> on 2017/01/24 10:33:02 UTC
Always get the false value when calling org.apache.maven.shared.invoker.InvovationRequest.isUpdateSnapshots()
Hello,
Using the org.apache.maven.shared.invoker.InvovationRequest leads to get
always the false value, even if the "-U" or "--update-snapshots" option is
set.
InvocationRequest request = new DefaultInvocationRequest();
updateSnapshots = request.isUpdateSnapshots();
Posts @
http://maven.40175.n5.nabble.com/Plugin-Development-Injection-of-component-td5747607.html
don't explain exactly if it is possible to get the value of an option, it
seems to be used to set the value of an option.
Thanks a lot for your help.
Regards.
Samuel Gaspari
Re: Always get the false value when calling org.apache.maven.shared.invoker.InvovationRequest.isUpdateSnapshots()
Posted by Alix Lourme <al...@gmail.com>.
Roohh ... I discover the MavenSession usage and its capacity. I will
review all my plugins :-).
Happy to discover some powerfull things like that the weekend, just many
thanks Hervé.
2017-01-28 13:21 GMT+01:00 Hervé BOUTEMY <he...@free.fr>:
> what about MavenSession.getRequest().isUpdateSnapshots()?
> with MavenSession injected, of course
>
> Regards,
>
> Hervé
>
> Le vendredi 27 janvier 2017, 16:14:45 CET Alix Lourme a écrit :
> > Hi Samuel,
> >
> > If your substantive question is: "*How to catch the usage of
> > --update-snapshots on the Maven command line ?*", I'm not sure
> > *DefaultInvocationRequest
> > *is a way (used for maven-invoker call).
> >
> > I had to do it in the past, and I have not found convenience solution
> like
> > some others parameters (ex: *offline* option, retrieved from settings).
> >
> > A workaround could be (not work on all JRE):
> >
> > String arguments =
> >
> > > ManagementFactory.getRuntimeMXBean().getSystemProperties().get(
> > > "sun.java.command");
> >
> > boolean isUpdateSnaphots = arguments.contains("-U") ||
> arguments.contains(
> >
> > > "--update-snapshots");
> >
> > LOG.debug("isUpdateSnapshots: {}", isUpdateSnaphots);
> >
> >
> > But perhaps that Maven core team could give a more sustainable solution
> ...
> >
> > Best regards
> >
> > 2017-01-24 11:33 GMT+01:00 Samuel Gaspari <sa...@gmail.com>:
> > > Hello,
> > > Using the org.apache.maven.shared.invoker.InvovationRequest leads to
> get
> > > always the false value, even if the "-U" or "--update-snapshots"
> option is
> > > set.
> > >
> > > InvocationRequest request = new DefaultInvocationRequest();
> > > updateSnapshots = request.isUpdateSnapshots();
> > >
> > > Posts @
> > > http://maven.40175.n5.nabble.com/Plugin-Development-> >
> Injection-of-component-td5747607.html
> > > don't explain exactly if it is possible to get the value of an option,
> it
> > > seems to be used to set the value of an option.
> > >
> > > Thanks a lot for your help.
> > >
> > > Regards.
> > >
> > > Samuel Gaspari
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>
--
Alix Lourme
Re: Always get the false value when calling org.apache.maven.shared.invoker.InvovationRequest.isUpdateSnapshots()
Posted by Hervé BOUTEMY <he...@free.fr>.
what about MavenSession.getRequest().isUpdateSnapshots()?
with MavenSession injected, of course
Regards,
Hervé
Le vendredi 27 janvier 2017, 16:14:45 CET Alix Lourme a écrit :
> Hi Samuel,
>
> If your substantive question is: "*How to catch the usage of
> --update-snapshots on the Maven command line ?*", I'm not sure
> *DefaultInvocationRequest
> *is a way (used for maven-invoker call).
>
> I had to do it in the past, and I have not found convenience solution like
> some others parameters (ex: *offline* option, retrieved from settings).
>
> A workaround could be (not work on all JRE):
>
> String arguments =
>
> > ManagementFactory.getRuntimeMXBean().getSystemProperties().get(
> > "sun.java.command");
>
> boolean isUpdateSnaphots = arguments.contains("-U") || arguments.contains(
>
> > "--update-snapshots");
>
> LOG.debug("isUpdateSnapshots: {}", isUpdateSnaphots);
>
>
> But perhaps that Maven core team could give a more sustainable solution ...
>
> Best regards
>
> 2017-01-24 11:33 GMT+01:00 Samuel Gaspari <sa...@gmail.com>:
> > Hello,
> > Using the org.apache.maven.shared.invoker.InvovationRequest leads to get
> > always the false value, even if the "-U" or "--update-snapshots" option is
> > set.
> >
> > InvocationRequest request = new DefaultInvocationRequest();
> > updateSnapshots = request.isUpdateSnapshots();
> >
> > Posts @
> > http://maven.40175.n5.nabble.com/Plugin-Development-> > Injection-of-component-td5747607.html
> > don't explain exactly if it is possible to get the value of an option, it
> > seems to be used to set the value of an option.
> >
> > Thanks a lot for your help.
> >
> > Regards.
> >
> > Samuel Gaspari
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: Always get the false value when calling org.apache.maven.shared.invoker.InvovationRequest.isUpdateSnapshots()
Posted by Alix Lourme <al...@gmail.com>.
Hi Samuel,
If your substantive question is: "*How to catch the usage of
--update-snapshots on the Maven command line ?*", I'm not sure
*DefaultInvocationRequest
*is a way (used for maven-invoker call).
I had to do it in the past, and I have not found convenience solution like
some others parameters (ex: *offline* option, retrieved from settings).
A workaround could be (not work on all JRE):
String arguments =
> ManagementFactory.getRuntimeMXBean().getSystemProperties().get(
> "sun.java.command");
boolean isUpdateSnaphots = arguments.contains("-U") || arguments.contains(
> "--update-snapshots");
LOG.debug("isUpdateSnapshots: {}", isUpdateSnaphots);
But perhaps that Maven core team could give a more sustainable solution ...
Best regards
2017-01-24 11:33 GMT+01:00 Samuel Gaspari <sa...@gmail.com>:
> Hello,
> Using the org.apache.maven.shared.invoker.InvovationRequest leads to get
> always the false value, even if the "-U" or "--update-snapshots" option is
> set.
>
> InvocationRequest request = new DefaultInvocationRequest();
> updateSnapshots = request.isUpdateSnapshots();
>
> Posts @
> http://maven.40175.n5.nabble.com/Plugin-Development-
> Injection-of-component-td5747607.html
> don't explain exactly if it is possible to get the value of an option, it
> seems to be used to set the value of an option.
>
> Thanks a lot for your help.
>
> Regards.
>
> Samuel Gaspari
>
--
Alix Lourme