Small enhancement to P2ApplicationLauncher

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Small enhancement to P2ApplicationLauncher

Spencer Uresk
I'm attempting to leverage code in Tycho to create a Maven plugin that mirrors P2 repositories. I ran into one small issue using P2ApplicationLauncher to launch Eclipse and call the mirror tasks. Basically, mirroring repositories requires multiple Eclipse calls (2 * number of sites you are mirroring) and P2ApplicationLauncher doesn't support multiple calls very well. This is because you can add arguments to the launcher, but can never remove or reset the args.

I was able to work around this easily by making my own version of the P2ApplicationLauncher [1] that has a clearArgs() method that will reset the args and vmargs (although it looks like vmargs isn't being used currently), which allows the launcher to be cleanly used multiple times. With that in mind, I have 2 questions:

1) Is there a better way to do this? I was basically following the pattern in the PublishFeaturesAndBundles mojo in tycho-extras.

2) If there isn't, is there a chance I can get this small change back into Tycho? If so I can make the change and open a pull request on Github.
Reply | Threaded
Open this post in threaded view
|

Re: Small enhancement to P2ApplicationLauncher

Igor Fedorenko-2
What is the advantage of reusing P2ApplicationLauncher instance vs
creating a new one for each launch?

--
Regards,
Igor

On 11-02-21 07:47 PM, Spencer Uresk wrote:

> I'm attempting to leverage code in Tycho to create a Maven plugin that
> mirrors P2 repositories. I ran into one small issue using
> P2ApplicationLauncher to launch Eclipse and call the mirror tasks.
> Basically, mirroring repositories requires multiple Eclipse calls (2 *
> number of sites you are mirroring) and P2ApplicationLauncher doesn't
> support multiple calls very well. This is because you can add arguments
> to the launcher, but can never remove or reset the args.
>
> I was able to work around this easily by making my own version of the
> P2ApplicationLauncher [1] that has a clearArgs() method that will reset
> the args and vmargs (although it looks like vmargs isn't being used
> currently), which allows the launcher to be cleanly used multiple times.
> With that in mind, I have 2 questions:
>
> 1) Is there a better way to do this? I was basically following the
> pattern in the PublishFeaturesAndBundles mojo in tycho-extras.
>
> 2) If there isn't, is there a chance I can get this small change back
> into Tycho? If so I can make the change and open a pull request on Github.
>
> Thanks,
>
> - Spencer
>
> 1.
> https://github.com/suresk/tycho-extras/blob/master/tycho-p2-extras-plugin/src/main/java/org/sonatype/tycho/plugins/p2/extras/P2Launcher.java#L143
Reply | Threaded
Open this post in threaded view
|

Re: Small enhancement to P2ApplicationLauncher

Spencer Uresk
Actually, sorry, this was an issue with me not knowing enough about Plexus. I figured out how to get a new instance instead of having to reuse the same one.

- Spencer

On Mon, Feb 21, 2011 at 6:01 PM, Igor Fedorenko <[hidden email]> wrote:
What is the advantage of reusing P2ApplicationLauncher instance vs
creating a new one for each launch?

--
Regards,
Igor


On 11-02-21 07:47 PM, Spencer Uresk wrote:
I'm attempting to leverage code in Tycho to create a Maven plugin that
mirrors P2 repositories. I ran into one small issue using
P2ApplicationLauncher to launch Eclipse and call the mirror tasks.
Basically, mirroring repositories requires multiple Eclipse calls (2 *
number of sites you are mirroring) and P2ApplicationLauncher doesn't
support multiple calls very well. This is because you can add arguments
to the launcher, but can never remove or reset the args.

I was able to work around this easily by making my own version of the
P2ApplicationLauncher [1] that has a clearArgs() method that will reset
the args and vmargs (although it looks like vmargs isn't being used
currently), which allows the launcher to be cleanly used multiple times.
With that in mind, I have 2 questions:

1) Is there a better way to do this? I was basically following the
pattern in the PublishFeaturesAndBundles mojo in tycho-extras.

2) If there isn't, is there a chance I can get this small change back
into Tycho? If so I can make the change and open a pull request on Github.

Thanks,

- Spencer

1.
https://github.com/suresk/tycho-extras/blob/master/tycho-p2-extras-plugin/src/main/java/org/sonatype/tycho/plugins/p2/extras/P2Launcher.java#L143