Re: Plugins with parameters and defaultValue

2014-02-08 Thread Hervé BOUTEMY
the confusion is that MojoExecution, MavenSession, MavenProject, and generally 
everything injected by PluginParameterExpressionEvaluator [1] are not Plexus 
components
Fields marked by @Component are not injected by 
PluginParameterExpressionEvaluator, only fields marked by @Parameter are 
injected like this

Regards,

Hervé


[1] 
http://maven.apache.org/ref/3-LATEST/maven-core/apidocs/org/apache/maven/plugin/PluginParameterExpressionEvaluator.html

Le jeudi 6 février 2014 20:32:47 Igor Fedorenko a écrit :
 Hervé,
 
 Can you explain what confusion this causes?
 
 --
 Regards,
 Igor
 
 On 2/6/2014, 16:47, Hervé BOUTEMY wrote:
  Hi,
  
  You'd better not use the @Component annotation but @Parameter instead:
  this is a feature that will be deprecated in future version:
  
  http://jira.codehaus.org/browse/MPLUGIN-257
  
  Regards,
  
  Hervé
  
  Le jeudi 6 février 2014 22:04:57 Karl Heinz Marbaise a écrit :
  Hi,
  
  in the meantime i found a better way (thanks to Robert Scholte):
@Component
private MojoExecution mojoExecution;


mojoExecution.getExecutionId();
mojoExecution.getConfiguration();
  
  Kind regards
  Karl Heinz Marbaise
  
  -
  To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
  For additional commands, e-mail: dev-h...@maven.apache.org
  
  -
  To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
  For additional commands, e-mail: dev-h...@maven.apache.org
 
 -
 To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
 For additional commands, e-mail: dev-h...@maven.apache.org


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



Re: Plugins with parameters and defaultValue

2014-02-08 Thread Igor Fedorenko

I think confusion is rather subjective term. Personally, I find

@Parameter(defaultValue=${session})
MavenSession session;

far more confusing than

@Component
MavenSession session;


This is particular true in 3.2.0, which allows injection of
MojoExecution, MavenSession and MavenProject via mojo execution Guice
scope I introduced in [1]


[1] 
https://git-wip-us.apache.org/repos/asf?p=maven.git;a=commit;h=8700b058574ea79544603ee4eacd6171ef03aa46


--
Regards,
Igor

On 2/8/2014, 5:15, Hervé BOUTEMY wrote:

the confusion is that MojoExecution, MavenSession, MavenProject, and generally
everything injected by PluginParameterExpressionEvaluator [1] are not Plexus
components
Fields marked by @Component are not injected by
PluginParameterExpressionEvaluator, only fields marked by @Parameter are
injected like this

Regards,

Hervé


[1] 
http://maven.apache.org/ref/3-LATEST/maven-core/apidocs/org/apache/maven/plugin/PluginParameterExpressionEvaluator.html

Le jeudi 6 février 2014 20:32:47 Igor Fedorenko a écrit :

Hervé,

Can you explain what confusion this causes?

--
Regards,
Igor

On 2/6/2014, 16:47, Hervé BOUTEMY wrote:

Hi,

You'd better not use the @Component annotation but @Parameter instead:
this is a feature that will be deprecated in future version:

http://jira.codehaus.org/browse/MPLUGIN-257

Regards,

Hervé

Le jeudi 6 février 2014 22:04:57 Karl Heinz Marbaise a écrit :

Hi,

in the meantime i found a better way (thanks to Robert Scholte):
   @Component
   private MojoExecution mojoExecution;


   mojoExecution.getExecutionId();
   mojoExecution.getConfiguration();

Kind regards
Karl Heinz Marbaise

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


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


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



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



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



Re: Plugins with parameters and defaultValue

2014-02-08 Thread Hervé BOUTEMY
ok, here the confusion is that there are 2 @Component annotations:
org.apache.maven.plugins.annotations.Component = plugin-tools
and
org.codehaus.plexus.component.annotations.Component = Plexus on Guice

plugin-tools @Component annotation for objects injected by 
PluginParameterExpressionEvaluator causes confusion at plugin-tools level

Regards,

Hervé

Le samedi 8 février 2014 09:06:40 Igor Fedorenko a écrit :
 I think confusion is rather subjective term. Personally, I find
 
  @Parameter(defaultValue=${session})
  MavenSession session;
 
 far more confusing than
 
  @Component
  MavenSession session;
 
 
 This is particular true in 3.2.0, which allows injection of
 MojoExecution, MavenSession and MavenProject via mojo execution Guice
 scope I introduced in [1]
 
 
 [1]
 https://git-wip-us.apache.org/repos/asf?p=maven.git;a=commit;h=8700b058574ea
 79544603ee4eacd6171ef03aa46
 
 --
 Regards,
 Igor
 
 On 2/8/2014, 5:15, Hervé BOUTEMY wrote:
  the confusion is that MojoExecution, MavenSession, MavenProject, and
  generally everything injected by PluginParameterExpressionEvaluator [1]
  are not Plexus components
  Fields marked by @Component are not injected by
  PluginParameterExpressionEvaluator, only fields marked by @Parameter are
  injected like this
  
  Regards,
  
  Hervé
  
  
  [1]
  http://maven.apache.org/ref/3-LATEST/maven-core/apidocs/org/apache/maven/
  plugin/PluginParameterExpressionEvaluator.html 
  Le jeudi 6 février 2014 20:32:47 Igor Fedorenko a écrit :
  Hervé,
  
  Can you explain what confusion this causes?
  
  --
  Regards,
  Igor
  
  On 2/6/2014, 16:47, Hervé BOUTEMY wrote:
  Hi,
  
  You'd better not use the @Component annotation but @Parameter instead:
  this is a feature that will be deprecated in future version:
  
  http://jira.codehaus.org/browse/MPLUGIN-257
  
  Regards,
  
  Hervé
  
  Le jeudi 6 février 2014 22:04:57 Karl Heinz Marbaise a écrit :
  Hi,
  
  in the meantime i found a better way (thanks to Robert Scholte):
 @Component
 private MojoExecution mojoExecution;
 
 
 mojoExecution.getExecutionId();
 mojoExecution.getConfiguration();
  
  Kind regards
  Karl Heinz Marbaise
  
  -
  To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
  For additional commands, e-mail: dev-h...@maven.apache.org
  
  -
  To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
  For additional commands, e-mail: dev-h...@maven.apache.org
  
  -
  To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
  For additional commands, e-mail: dev-h...@maven.apache.org
  
  -
  To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
  For additional commands, e-mail: dev-h...@maven.apache.org
 
 -
 To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
 For additional commands, e-mail: dev-h...@maven.apache.org


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



Re: Plugins with parameters and defaultValue

2014-02-08 Thread Igor Fedorenko



On 2/8/2014, 9:56, Hervé BOUTEMY wrote:

ok, here the confusion is that there are 2 @Component annotations:
org.apache.maven.plugins.annotations.Component = plugin-tools
and
org.codehaus.plexus.component.annotations.Component = Plexus on Guice

plugin-tools @Component annotation for objects injected by
PluginParameterExpressionEvaluator causes confusion at plugin-tools level



Can you point me at the code that implements this? I was under
impression that plugin-tools @Component was translated to plexus/guice
requirement at runtime and there was no real difference between the two.
Any special handing of @Component in PluginParameterExpressionEvaluator
should not be necessary in 3.2 and I would like to clean this up.

--
Regards,
Igor

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



Re: Plugins with parameters and defaultValue

2014-02-08 Thread Hervé BOUTEMY
ok, now I understand where we diverge

yes, normal plugin-tools @Component are translated into Plexus requirements

but actual plugin-tools @Component support for Maven objects is a hack that 
translates into parameter, not into requirement [1]

so this hack is confusing

when this hack will be removed, real @Component translated to Plexus 
requirements will be possible: for the moment, the hack makes such thing 
impossible

Regards,

Hervé

[1] 
http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/JavaAnnotationsMojoDescriptorExtractor.java?r1=1341650r2=1343086pathrev=1343086diff_format=h

Le samedi 8 février 2014 11:00:48 Igor Fedorenko a écrit :
 On 2/8/2014, 9:56, Hervé BOUTEMY wrote:
  ok, here the confusion is that there are 2 @Component annotations:
  org.apache.maven.plugins.annotations.Component = plugin-tools
  and
  org.codehaus.plexus.component.annotations.Component = Plexus on Guice
  
  plugin-tools @Component annotation for objects injected by
  PluginParameterExpressionEvaluator causes confusion at plugin-tools level
 
 Can you point me at the code that implements this? I was under
 impression that plugin-tools @Component was translated to plexus/guice
 requirement at runtime and there was no real difference between the two.
 Any special handing of @Component in PluginParameterExpressionEvaluator
 should not be necessary in 3.2 and I would like to clean this up.
 
 --
 Regards,
 Igor
 
 -
 To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
 For additional commands, e-mail: dev-h...@maven.apache.org


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



Re: Plugins with parameters and defaultValue

2014-02-08 Thread Robert Scholte

If I'm correct, these are all the same:

CDI  @Inject
Plexus'  @Requirement
Plugin's @Component

However, the way MavenSession, MavenProject and MojoExecution are injected  
isn't done by DI, but by the expression evaluator.


Robert

Op Sat, 08 Feb 2014 17:00:48 +0100 schreef Igor Fedorenko  
i...@ifedorenko.com:





On 2/8/2014, 9:56, Hervé BOUTEMY wrote:

ok, here the confusion is that there are 2 @Component annotations:
org.apache.maven.plugins.annotations.Component = plugin-tools
and
org.codehaus.plexus.component.annotations.Component = Plexus on Guice

plugin-tools @Component annotation for objects injected by
PluginParameterExpressionEvaluator causes confusion at plugin-tools  
level




Can you point me at the code that implements this? I was under
impression that plugin-tools @Component was translated to plexus/guice
requirement at runtime and there was no real difference between the two.
Any special handing of @Component in PluginParameterExpressionEvaluator
should not be necessary in 3.2 and I would like to clean this up.

--
Regards,
Igor

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


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



Re: Plugins with parameters and defaultValue

2014-02-08 Thread Igor Fedorenko

In 3.2 it is possible to use jsr330 @Inject and plexus @Requirement to
inject MavenSession, MavenProject and MojoExecution.

--
Regards,
Igor

On 2/8/2014, 11:10, Robert Scholte wrote:

If I'm correct, these are all the same:

CDI  @Inject
Plexus'  @Requirement
Plugin's @Component

However, the way MavenSession, MavenProject and MojoExecution are
injected isn't done by DI, but by the expression evaluator.

Robert

Op Sat, 08 Feb 2014 17:00:48 +0100 schreef Igor Fedorenko
i...@ifedorenko.com:




On 2/8/2014, 9:56, Hervé BOUTEMY wrote:

ok, here the confusion is that there are 2 @Component annotations:
org.apache.maven.plugins.annotations.Component = plugin-tools
and
org.codehaus.plexus.component.annotations.Component = Plexus on Guice

plugin-tools @Component annotation for objects injected by
PluginParameterExpressionEvaluator causes confusion at plugin-tools
level



Can you point me at the code that implements this? I was under
impression that plugin-tools @Component was translated to plexus/guice
requirement at runtime and there was no real difference between the two.
Any special handing of @Component in PluginParameterExpressionEvaluator
should not be necessary in 3.2 and I would like to clean this up.

--
Regards,
Igor

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


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



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



Re: Plugins with parameters and defaultValue

2014-02-08 Thread Igor Fedorenko

Got it. Yes, I agree plugin-tools @Component is confusing :-)

--
Regards,
Igor

On 2/8/2014, 11:08, Hervé BOUTEMY wrote:

ok, now I understand where we diverge

yes, normal plugin-tools @Component are translated into Plexus requirements

but actual plugin-tools @Component support for Maven objects is a hack that
translates into parameter, not into requirement [1]

so this hack is confusing

when this hack will be removed, real @Component translated to Plexus
requirements will be possible: for the moment, the hack makes such thing
impossible

Regards,

Hervé

[1] 
http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/JavaAnnotationsMojoDescriptorExtractor.java?r1=1341650r2=1343086pathrev=1343086diff_format=h

Le samedi 8 février 2014 11:00:48 Igor Fedorenko a écrit :

On 2/8/2014, 9:56, Hervé BOUTEMY wrote:

ok, here the confusion is that there are 2 @Component annotations:
org.apache.maven.plugins.annotations.Component = plugin-tools
and
org.codehaus.plexus.component.annotations.Component = Plexus on Guice

plugin-tools @Component annotation for objects injected by
PluginParameterExpressionEvaluator causes confusion at plugin-tools level


Can you point me at the code that implements this? I was under
impression that plugin-tools @Component was translated to plexus/guice
requirement at runtime and there was no real difference between the two.
Any special handing of @Component in PluginParameterExpressionEvaluator
should not be necessary in 3.2 and I would like to clean this up.

--
Regards,
Igor

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



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



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



Re: Plugins with parameters and defaultValue

2014-02-08 Thread Hervé BOUTEMY
ok, so the other confusing part in plugin-tools is to have a @Component 
annotation equivalent to Plexus' @Requirement and not Plexus' @Component 
(which defines a component, not uses it)

so perhaps we should deprecate plugin-tools @component/@Component in favor of 
a new @requirement/@Requirement

(notice this part doesn't have anything to do with the hack for pseudo 
component)

WDYT?

Hervé

Le samedi 8 février 2014 17:10:55 Robert Scholte a écrit :
 If I'm correct, these are all the same:
 
 CDI  @Inject
 Plexus'  @Requirement
 Plugin's @Component
 
 However, the way MavenSession, MavenProject and MojoExecution are injected
 isn't done by DI, but by the expression evaluator.
 
 Robert
 
 Op Sat, 08 Feb 2014 17:00:48 +0100 schreef Igor Fedorenko
 
 i...@ifedorenko.com:
  On 2/8/2014, 9:56, Hervé BOUTEMY wrote:
  ok, here the confusion is that there are 2 @Component annotations:
  org.apache.maven.plugins.annotations.Component = plugin-tools
  and
  org.codehaus.plexus.component.annotations.Component = Plexus on Guice
  
  plugin-tools @Component annotation for objects injected by
  PluginParameterExpressionEvaluator causes confusion at plugin-tools
  level
  
  Can you point me at the code that implements this? I was under
  impression that plugin-tools @Component was translated to plexus/guice
  requirement at runtime and there was no real difference between the two.
  Any special handing of @Component in PluginParameterExpressionEvaluator
  should not be necessary in 3.2 and I would like to clean this up.
  
  --
  Regards,
  Igor
  
  -
  To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
  For additional commands, e-mail: dev-h...@maven.apache.org
 
 -
 To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
 For additional commands, e-mail: dev-h...@maven.apache.org


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



Re: Plugins with parameters and defaultValue

2014-02-08 Thread Igor Fedorenko

Why not use jsr330 or plexus annotations and just deprecate plugin-tools
@Component annotation?

--
Regards,
Igor

On 2/8/2014, 11:24, Hervé BOUTEMY wrote:

ok, so the other confusing part in plugin-tools is to have a @Component
annotation equivalent to Plexus' @Requirement and not Plexus' @Component
(which defines a component, not uses it)

so perhaps we should deprecate plugin-tools @component/@Component in favor of
a new @requirement/@Requirement

(notice this part doesn't have anything to do with the hack for pseudo
component)

WDYT?

Hervé

Le samedi 8 février 2014 17:10:55 Robert Scholte a écrit :

If I'm correct, these are all the same:

CDI  @Inject
Plexus'  @Requirement
Plugin's @Component

However, the way MavenSession, MavenProject and MojoExecution are injected
isn't done by DI, but by the expression evaluator.

Robert

Op Sat, 08 Feb 2014 17:00:48 +0100 schreef Igor Fedorenko

i...@ifedorenko.com:

On 2/8/2014, 9:56, Hervé BOUTEMY wrote:

ok, here the confusion is that there are 2 @Component annotations:
org.apache.maven.plugins.annotations.Component = plugin-tools
and
org.codehaus.plexus.component.annotations.Component = Plexus on Guice

plugin-tools @Component annotation for objects injected by
PluginParameterExpressionEvaluator causes confusion at plugin-tools
level


Can you point me at the code that implements this? I was under
impression that plugin-tools @Component was translated to plexus/guice
requirement at runtime and there was no real difference between the two.
Any special handing of @Component in PluginParameterExpressionEvaluator
should not be necessary in 3.2 and I would like to clean this up.

--
Regards,
Igor

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


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



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



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



Re: Plugins with parameters and defaultValue

2014-02-08 Thread Hervé BOUTEMY
good idea: if we do deprecate plugin-tools' @component, no need to create new 
annotations, but better reuse

thanks you for the idea

Hervé

Le samedi 8 février 2014 11:27:19 Igor Fedorenko a écrit :
 Why not use jsr330 or plexus annotations and just deprecate plugin-tools
 @Component annotation?
 
 --
 Regards,
 Igor
 
 On 2/8/2014, 11:24, Hervé BOUTEMY wrote:
  ok, so the other confusing part in plugin-tools is to have a @Component
  annotation equivalent to Plexus' @Requirement and not Plexus' @Component
  (which defines a component, not uses it)
  
  so perhaps we should deprecate plugin-tools @component/@Component in favor
  of a new @requirement/@Requirement
  
  (notice this part doesn't have anything to do with the hack for pseudo
  component)
  
  WDYT?
  
  Hervé
  
  Le samedi 8 février 2014 17:10:55 Robert Scholte a écrit :
  If I'm correct, these are all the same:
  
  CDI  @Inject
  Plexus'  @Requirement
  Plugin's @Component
  
  However, the way MavenSession, MavenProject and MojoExecution are
  injected
  isn't done by DI, but by the expression evaluator.
  
  Robert
  
  Op Sat, 08 Feb 2014 17:00:48 +0100 schreef Igor Fedorenko
  
  i...@ifedorenko.com:
  On 2/8/2014, 9:56, Hervé BOUTEMY wrote:
  ok, here the confusion is that there are 2 @Component annotations:
  org.apache.maven.plugins.annotations.Component = plugin-tools
  and
  org.codehaus.plexus.component.annotations.Component = Plexus on Guice
  
  plugin-tools @Component annotation for objects injected by
  PluginParameterExpressionEvaluator causes confusion at plugin-tools
  level
  
  Can you point me at the code that implements this? I was under
  impression that plugin-tools @Component was translated to plexus/guice
  requirement at runtime and there was no real difference between the two.
  Any special handing of @Component in PluginParameterExpressionEvaluator
  should not be necessary in 3.2 and I would like to clean this up.
  
  --
  Regards,
  Igor
  
  -
  To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
  For additional commands, e-mail: dev-h...@maven.apache.org
  
  -
  To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
  For additional commands, e-mail: dev-h...@maven.apache.org
  
  -
  To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
  For additional commands, e-mail: dev-h...@maven.apache.org
 
 -
 To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
 For additional commands, e-mail: dev-h...@maven.apache.org


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



Re: Plugins with parameters and defaultValue

2014-02-06 Thread Karl Heinz Marbaise

Hi Baptiste,


first thanks for the links and answers...

 Here's the thread:

http://maven.40175.n5.nabble.com/Maven2-Maven3-plugin-development-Ensuring-only-the-available-parameters-are-allowed-tp5780854p5780948.html

Maybe I'd try something along those lines:

Plugin plugin = lookupThePluginYouWant(project.getBuildPlugins());
Xpp3Dom config = (Xpp3Dom) plugin.getConfiguration();
// Unleash hell


This brought me into the right direction

What i have so far:

Using the following:

@Component
private PluginDescriptor pluginDescriptor;


and now in the and execution method of a mojo like this:


Xpp3Dom globalConfiguration = (Xpp3Dom) 
pluginDescriptor.getPlugin().getConfiguration();


This will give me the global configuration which means the part...

plugin
  g./g..
  a./a..
  v./v..
  configuration
!-- Global Configuration --
  /configuration
  executions
execution
  id.../id
  configuration
!-- exec configuration --
  /configuration
...
 /...

via the following code snippet i can get access to the
exec configurations:

ListPluginExecution executions = 
pluginDescriptor.getPlugin().getExecutions();

for ( PluginExecution pluginExecution : executions )
{
   Xpp3Dom executionConfiguration = (Xpp3Dom) 
pluginExecution.getConfiguration();

}

but now I have the problem which of the exec configuration is one which 
currently being executed ? Of course i can iterator through the list of 
executions, but how do i know which is the correct one ?



Kind regards
Karl Heinz Marbaise


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



Re: Plugins with parameters and defaultValue

2014-02-06 Thread Karl Heinz Marbaise

Hi,

in the meantime i found a better way (thanks to Robert Scholte):

@Component
private MojoExecution mojoExecution;


mojoExecution.getExecutionId();
mojoExecution.getConfiguration();

Kind regards
Karl Heinz Marbaise

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



Re: Plugins with parameters and defaultValue

2014-02-06 Thread Hervé BOUTEMY
Hi,

You'd better not use the @Component annotation but @Parameter instead: this is 
a feature that will be deprecated in future version:

http://jira.codehaus.org/browse/MPLUGIN-257

Regards,

Hervé

Le jeudi 6 février 2014 22:04:57 Karl Heinz Marbaise a écrit :
 Hi,
 
 in the meantime i found a better way (thanks to Robert Scholte):
 
  @Component
  private MojoExecution mojoExecution;
 
 
  mojoExecution.getExecutionId();
  mojoExecution.getConfiguration();
 
 Kind regards
 Karl Heinz Marbaise
 
 -
 To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
 For additional commands, e-mail: dev-h...@maven.apache.org


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



Re: Plugins with parameters and defaultValue

2014-02-06 Thread Karl Heinz Marbaise

Hi Hervé,


Hi,

You'd better not use the @Component annotation but @Parameter instead: this is
a feature that will be deprecated in future version:

http://jira.codehaus.org/browse/MPLUGIN-257


Thanks for the hint learnt already (via IRC) the right way via 
@Parameter ...


But according to the JIRA ticket it sounds like the wise way is to 
change the following:



@Component
private MavenSession mavenSession;


into this (as mentioned in the JIRA ticket):

@Parameter( defaultValue=${session}, readonly=true )
private MavenSession session;


Thanks...

Kind regards
Karl Heinz




Regards,

Hervé

Le jeudi 6 février 2014 22:04:57 Karl Heinz Marbaise a écrit :

Hi,

in the meantime i found a better way (thanks to Robert Scholte):

  @Component
  private MojoExecution mojoExecution;


  mojoExecution.getExecutionId();
  mojoExecution.getConfiguration();

Kind regards
Karl Heinz Marbaise

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



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





Mit freundlichem Gruß
Karl-Heinz Marbaise
--
SoftwareEntwicklung Beratung SchulungTel.: +49 (0) 2405 / 415 893
Dipl.Ing.(FH) Karl-Heinz MarbaiseICQ#: 135949029
Hauptstrasse 177 USt.IdNr: DE191347579
52146 Würselen   http://www.soebes.de

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



Re: Plugins with parameters and defaultValue

2014-02-06 Thread Igor Fedorenko

Hervé,

Can you explain what confusion this causes?

--
Regards,
Igor

On 2/6/2014, 16:47, Hervé BOUTEMY wrote:

Hi,

You'd better not use the @Component annotation but @Parameter instead: this is
a feature that will be deprecated in future version:

http://jira.codehaus.org/browse/MPLUGIN-257

Regards,

Hervé

Le jeudi 6 février 2014 22:04:57 Karl Heinz Marbaise a écrit :

Hi,

in the meantime i found a better way (thanks to Robert Scholte):

  @Component
  private MojoExecution mojoExecution;


  mojoExecution.getExecutionId();
  mojoExecution.getConfiguration();

Kind regards
Karl Heinz Marbaise

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



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



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



Re: Plugins with parameters and defaultValue

2014-02-05 Thread Karl Heinz Marbaise

Hi Baptiste,


 Hi,

I think I remember a recent answer from Stephen about plugin conf,
saying basically you'd just have to fall back to xpath project/build and
then see what's present.

First thanks for the hint...

Any knowledge where to search for ?

Or Stephen ? Do you have a hint ?

Does exist an example within the apache maven plugins for such thing?

Kind regards
Karl-Heinz Marbaise


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



Re: Plugins with parameters and defaultValue

2014-02-05 Thread Baptiste Mathus
Here's the thread:
http://maven.40175.n5.nabble.com/Maven2-Maven3-plugin-development-Ensuring-only-the-available-parameters-are-allowed-tp5780854p5780948.html

Maybe I'd try something along those lines:

Plugin plugin = lookupThePluginYouWant(project.getBuildPlugins());
Xpp3Dom config = (Xpp3Dom) plugin.getConfiguration();
// Unleash hell

?

HTH


2014-02-05 Karl Heinz Marbaise khmarba...@gmx.de:

 Hi Baptiste,



  Hi,

 I think I remember a recent answer from Stephen about plugin conf,
 saying basically you'd just have to fall back to xpath project/build and
 then see what's present.

 First thanks for the hint...

 Any knowledge where to search for ?

 Or Stephen ? Do you have a hint ?

 Does exist an example within the apache maven plugins for such thing?

 Kind regards
 Karl-Heinz Marbaise



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

 --
 Baptiste Batmat MATHUS - http://batmat.net
 Sauvez un arbre,
 Mangez un castor ! nbsp;! dev-h...@maven.apache.org



RE: Plugins with parameters and defaultValue

2014-02-02 Thread Robert Patrick
From what I can tell in my testing, the @Parameter attributes required=true 
and defaultValue=some value are mutually exclusive (in terms of behavior).   
That is, if you combine defaultValue=... and required=true, defaultValue 
always satisfies the required=true setting, making required=true irrelevant.

If a defaultValue is provided (regardless of whether or not required=true is 
set or not), you will get the default value injected in the following 
configurations specified for the parameter myValue:
- myValue /myValue
- myValue/myValue
- myValue/
- myValue not specified in the configuration

If required=true is specified without a defaultValue specified, the same for 
cases above will cause build failures because the required parameter has not 
been specified.


--
Robert Patrick robert.patr...@oracle.com
VP, FMW Platform Architecture
Oracle Corporation  Office: +1.940.725.0011
1148 Triple Crown Court Fax: +1.940.725.0012
Bartonville, TX 76226, USA  Mobile: +1.469.556.9450

Professional Oracle WebLogic Server
by Robert Patrick, Gregory Nyberg, and Philip Aston
with Josh Bregman and Paul Done
Book Home Page: http://www.wrox.com/
Kindle Version: http://www.amazon.com/


-Original Message-
From: Karl Heinz Marbaise [mailto:khmarba...@gmx.de] 
Sent: Thursday, January 30, 2014 12:23 PM
To: dev@maven.apache.org
Subject: Plugins with parameters and defaultValue

Hi,

just a question concerning the usage of default values in a mojo...

If i define a default value for a parameter in a Mojo like the following:

@Parameter( defaultValue = ${project.build.finalName}, required = true ) 
private String finalName;

So the question is:

Can i see the difference in the mojo code if someone in the pom file has
written:

   finalName/
or
   just omit it.

or is this not possible ?


In my opinion it's not possible to distinguish between those two cases.

Any ideas ?

Thanks in advance.

Kind regards
Karl Heinz Marbaise


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


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



Plugins with parameters and defaultValue

2014-01-30 Thread Karl Heinz Marbaise

Hi,

just a question concerning the usage of default values in a mojo...

If i define a default value for a parameter in a Mojo like the following:

@Parameter( defaultValue = ${project.build.finalName}, required = true )
private String finalName;

So the question is:

Can i see the difference in the mojo code if someone in the pom file has 
written:


  finalName/
or
  just omit it.

or is this not possible ?


In my opinion it's not possible to distinguish between those two cases.

Any ideas ?

Thanks in advance.

Kind regards
Karl Heinz Marbaise


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



Re: Plugins with parameters and defaultValue

2014-01-30 Thread Baptiste Mathus
Hi,
I think I remember a recent answer from Stephen about plugin conf, saying
basically you'd just have to fall back to xpath project/build and then see
what's present.

My 2 cents


2014-01-30 Karl Heinz Marbaise khmarba...@gmx.de:

 Hi,

 just a question concerning the usage of default values in a mojo...

 If i define a default value for a parameter in a Mojo like the following:

 @Parameter( defaultValue = ${project.build.finalName}, required = true )
 private String finalName;

 So the question is:

 Can i see the difference in the mojo code if someone in the pom file has
 written:

   finalName/
 or
   just omit it.

 or is this not possible ?


 In my opinion it's not possible to distinguish between those two cases.

 Any ideas ?

 Thanks in advance.

 Kind regards
 Karl Heinz Marbaise


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

 --
 Baptiste Batmat MATHUS - http://batmat.net
 Sauvez un arbre,
 Mangez un castor ! nbsp;! dev-h...@maven.apache.org