You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Benjamin Bentmann <be...@udo.edu> on 2009/08/04 10:49:39 UTC

[DISCUCSS] Make ToolchainManagerPrivate session-aware

Hi,

in the interface ToolchainManagerPrivate, i.e. the one used by the 
maven-toolchain-plugin to setup the toolchains for a build, we currently 
have the method

     ToolchainPrivate[] getToolchainsForType( String type )

The impl of this method processes the toolchains.xml. Given the above 
method signature, there is currently no way to configure the path to the 
toolchains.xml without using global state in the component. This is 
troublesome for multi-threaded Maven executions, say during embedded usage.

Hence I suggest to extend the method to

     ToolchainPrivate[] getToolchainsForType( String type, MavenSession 
session )

i.e. additionally passing in the session. This is one way to allow the 
impl to query per-session config like the path to the toolchains.xml.

The maven-toolchain-plugin is the only client of the 
ToolchainManagerPrivate interface and was not released yet. However, 
changing the interface means the next plugin version can only be used 
with a new Maven version, say 2.3+.

Any other ideas?


Benjamin

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


Re: [DISCUCSS] Make ToolchainManagerPrivate session-aware

Posted by Stephen Connolly <st...@gmail.com>.
If the session has not been injected, then legacy behaviour... if it has,
use that one instead

2009/8/4 Stephen Connolly <st...@gmail.com>

> Add an interface
>
> public interface MavenSessionAware {
>   public void setMavenSession(MavenSession session);
>   public MavenSession getMavenSession();
> }
>
> and make the impl additionally implement the MavenSessionAware interface?
>
> 2009/8/4 Milos Kleint <mk...@gmail.com>
>
> unless the MavenSession can be somehow computed (how?) there's no other way
>> I can see.
>>
>> Milos
>>
>> On Tue, Aug 4, 2009 at 10:49 AM, Benjamin Bentmann <
>> benjamin.bentmann@udo.edu> wrote:
>>
>> > Hi,
>> >
>> > in the interface ToolchainManagerPrivate, i.e. the one used by the
>> > maven-toolchain-plugin to setup the toolchains for a build, we currently
>> > have the method
>> >
>> >    ToolchainPrivate[] getToolchainsForType( String type )
>> >
>> > The impl of this method processes the toolchains.xml. Given the above
>> > method signature, there is currently no way to configure the path to the
>> > toolchains.xml without using global state in the component. This is
>> > troublesome for multi-threaded Maven executions, say during embedded
>> usage.
>> >
>> > Hence I suggest to extend the method to
>> >
>> >    ToolchainPrivate[] getToolchainsForType( String type, MavenSession
>> > session )
>> >
>> > i.e. additionally passing in the session. This is one way to allow the
>> impl
>> > to query per-session config like the path to the toolchains.xml.
>> >
>> > The maven-toolchain-plugin is the only client of the
>> > ToolchainManagerPrivate interface and was not released yet. However,
>> > changing the interface means the next plugin version can only be used
>> with a
>> > new Maven version, say 2.3+.
>> >
>> > Any other ideas?
>> >
>> >
>> > Benjamin
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> > For additional commands, e-mail: dev-help@maven.apache.org
>> >
>> >
>>
>
>

Re: [DISCUCSS] Make ToolchainManagerPrivate session-aware

Posted by Stephen Connolly <st...@gmail.com>.
Ahh ok.... hmmm that won't work so

2009/8/4 Benjamin Bentmann <be...@udo.edu>

> Stephen Connolly wrote:
>
>  Add an interface
>>
>> public interface MavenSessionAware {
>>  public void setMavenSession(MavenSession session);
>>  public MavenSession getMavenSession();
>> }
>>
>> and make the impl additionally implement the MavenSessionAware interface?
>>
>
> If you refer to the impl of ToolchainManagerPrivate, this doesn't solve the
> problem. The aim is to make this component stateless.
>
>
>
> Benjamin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>

Re: [DISCUCSS] Make ToolchainManagerPrivate session-aware

Posted by Benjamin Bentmann <be...@udo.edu>.
Stephen Connolly wrote:

> Add an interface
> 
> public interface MavenSessionAware {
>   public void setMavenSession(MavenSession session);
>   public MavenSession getMavenSession();
> }
> 
> and make the impl additionally implement the MavenSessionAware interface?

If you refer to the impl of ToolchainManagerPrivate, this doesn't solve 
the problem. The aim is to make this component stateless.


Benjamin

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


Re: [DISCUCSS] Make ToolchainManagerPrivate session-aware

Posted by Stephen Connolly <st...@gmail.com>.
Add an interface

public interface MavenSessionAware {
  public void setMavenSession(MavenSession session);
  public MavenSession getMavenSession();
}

and make the impl additionally implement the MavenSessionAware interface?

2009/8/4 Milos Kleint <mk...@gmail.com>

> unless the MavenSession can be somehow computed (how?) there's no other way
> I can see.
>
> Milos
>
> On Tue, Aug 4, 2009 at 10:49 AM, Benjamin Bentmann <
> benjamin.bentmann@udo.edu> wrote:
>
> > Hi,
> >
> > in the interface ToolchainManagerPrivate, i.e. the one used by the
> > maven-toolchain-plugin to setup the toolchains for a build, we currently
> > have the method
> >
> >    ToolchainPrivate[] getToolchainsForType( String type )
> >
> > The impl of this method processes the toolchains.xml. Given the above
> > method signature, there is currently no way to configure the path to the
> > toolchains.xml without using global state in the component. This is
> > troublesome for multi-threaded Maven executions, say during embedded
> usage.
> >
> > Hence I suggest to extend the method to
> >
> >    ToolchainPrivate[] getToolchainsForType( String type, MavenSession
> > session )
> >
> > i.e. additionally passing in the session. This is one way to allow the
> impl
> > to query per-session config like the path to the toolchains.xml.
> >
> > The maven-toolchain-plugin is the only client of the
> > ToolchainManagerPrivate interface and was not released yet. However,
> > changing the interface means the next plugin version can only be used
> with a
> > new Maven version, say 2.3+.
> >
> > Any other ideas?
> >
> >
> > Benjamin
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > For additional commands, e-mail: dev-help@maven.apache.org
> >
> >
>

Re: [DISCUCSS] Make ToolchainManagerPrivate session-aware

Posted by Milos Kleint <mk...@gmail.com>.
unless the MavenSession can be somehow computed (how?) there's no other way
I can see.

Milos

On Tue, Aug 4, 2009 at 10:49 AM, Benjamin Bentmann <
benjamin.bentmann@udo.edu> wrote:

> Hi,
>
> in the interface ToolchainManagerPrivate, i.e. the one used by the
> maven-toolchain-plugin to setup the toolchains for a build, we currently
> have the method
>
>    ToolchainPrivate[] getToolchainsForType( String type )
>
> The impl of this method processes the toolchains.xml. Given the above
> method signature, there is currently no way to configure the path to the
> toolchains.xml without using global state in the component. This is
> troublesome for multi-threaded Maven executions, say during embedded usage.
>
> Hence I suggest to extend the method to
>
>    ToolchainPrivate[] getToolchainsForType( String type, MavenSession
> session )
>
> i.e. additionally passing in the session. This is one way to allow the impl
> to query per-session config like the path to the toolchains.xml.
>
> The maven-toolchain-plugin is the only client of the
> ToolchainManagerPrivate interface and was not released yet. However,
> changing the interface means the next plugin version can only be used with a
> new Maven version, say 2.3+.
>
> Any other ideas?
>
>
> Benjamin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>

Re: [DISCUCSS] Make ToolchainManagerPrivate session-aware

Posted by Benjamin Bentmann <be...@udo.edu>.
Benjamin Bentmann wrote:

> The maven-toolchain-plugin is the only client of the 
> ToolchainManagerPrivate interface and was not released yet. However, 
> changing the interface means the next plugin version can only be used 
> with a new Maven version, say 2.3+.

I updated the plugin to reflectively access the core component, not 
beautiful but works with all Maven versions.


Benjamin

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