Re: Read plugin configuration from another plugin

2016-04-28 Thread Julien HENRY
Thanks guys, I'll have a look.



Le Jeudi 28 avril 2016 12h44, Anton Tanasenko  a écrit 
:
Hey,

M2E is effectively doing LifecycleExecutor#calculateExecutionPlan(session,
false, "default").getMojoExecutions(), and each returned mojo execution has
a final xml config.



2016-04-28 13:00 GMT+03:00 Tamás Cservenák :

> Hi there,
>
> there is a POC I was toying with after ApacheCon last year. It is hacky,
> but I just wanted to see would it work:
>
> https://github.com/cstamas/configuration-maven-plugin
>
> If you want to _READ_ the config, same approach as above with lifecycle
> participant would work as it receives the _effective_ model. How would you
> _interpret_ the config is another story.
>
> Thanks,
> T
>
> On Thu, Apr 28, 2016 at 10:29 AM Julien HENRY 
> wrote:
>
> > Hi guys,
> >
> > The SonarQube plugin for Maven try to configure SonarQube analysis based
> > on Maven project configuration. We are interested by project model
> > (packaging, properties) but also by configuration of other plugins
> > (m-compiler-p source and target for example).
> >
> > Our approach to get this configuration is to read the pom using injected
> > MavenProject and get an Xpp3Dom [1]. This approach is very hacky since we
> > have to manually take care of all possible ways to configure a plugin:
> >   - configuration can be in build/plugins or in build/pluginsManagement
> or
> > even in reporting section
> >   - I'm not sure we are supporting configuration "per execution"
> >   - we are not supporting configuration provided using user properties
> > (see [2])
> >   - we have to hardcode default values
> >
> > So here is my question: is it possible for a plugin to get "resolved"
> > configuration from another plugin. I mean the configuration that would
> have
> > been injected in this other plugin at runtime.
> >
> > For example I would like to access value injected in compiler mojo for
> the
> > "source" attribute [3]. I guess m2e has a similar need but I don't know
> how
> > it works.
> >
> > Thanks for your help,
> >
> > Julien
> >
> >
> > [1]
> >
> https://github.com/SonarSource/sonar-maven/blob/master/src/main/java/org/sonarsource/scanner/maven/bootstrap/MavenPlugin.java#L104
> > [2] https://github.com/SonarSource/sonar-maven/pull/6
> > [3]
> >
> http://svn.apache.org/viewvc/maven/plugins/tags/maven-compiler-plugin-3.5.1/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java?view=markup#l133
> >
> > -
> > To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
> > For additional commands, e-mail: dev-h...@maven.apache.org
> >
> >
>



-- 
Regards,
Anton.

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



Re: Read plugin configuration from another plugin

2016-04-28 Thread Anton Tanasenko
Hey,

M2E is effectively doing LifecycleExecutor#calculateExecutionPlan(session,
false, "default").getMojoExecutions(), and each returned mojo execution has
a final xml config.


2016-04-28 13:00 GMT+03:00 Tamás Cservenák :

> Hi there,
>
> there is a POC I was toying with after ApacheCon last year. It is hacky,
> but I just wanted to see would it work:
>
> https://github.com/cstamas/configuration-maven-plugin
>
> If you want to _READ_ the config, same approach as above with lifecycle
> participant would work as it receives the _effective_ model. How would you
> _interpret_ the config is another story.
>
> Thanks,
> T
>
> On Thu, Apr 28, 2016 at 10:29 AM Julien HENRY 
> wrote:
>
> > Hi guys,
> >
> > The SonarQube plugin for Maven try to configure SonarQube analysis based
> > on Maven project configuration. We are interested by project model
> > (packaging, properties) but also by configuration of other plugins
> > (m-compiler-p source and target for example).
> >
> > Our approach to get this configuration is to read the pom using injected
> > MavenProject and get an Xpp3Dom [1]. This approach is very hacky since we
> > have to manually take care of all possible ways to configure a plugin:
> >   - configuration can be in build/plugins or in build/pluginsManagement
> or
> > even in reporting section
> >   - I'm not sure we are supporting configuration "per execution"
> >   - we are not supporting configuration provided using user properties
> > (see [2])
> >   - we have to hardcode default values
> >
> > So here is my question: is it possible for a plugin to get "resolved"
> > configuration from another plugin. I mean the configuration that would
> have
> > been injected in this other plugin at runtime.
> >
> > For example I would like to access value injected in compiler mojo for
> the
> > "source" attribute [3]. I guess m2e has a similar need but I don't know
> how
> > it works.
> >
> > Thanks for your help,
> >
> > Julien
> >
> >
> > [1]
> >
> https://github.com/SonarSource/sonar-maven/blob/master/src/main/java/org/sonarsource/scanner/maven/bootstrap/MavenPlugin.java#L104
> > [2] https://github.com/SonarSource/sonar-maven/pull/6
> > [3]
> >
> http://svn.apache.org/viewvc/maven/plugins/tags/maven-compiler-plugin-3.5.1/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java?view=markup#l133
> >
> > -
> > To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
> > For additional commands, e-mail: dev-h...@maven.apache.org
> >
> >
>



-- 
Regards,
Anton.


Re: Read plugin configuration from another plugin

2016-04-28 Thread Tamás Cservenák
Hi there,

there is a POC I was toying with after ApacheCon last year. It is hacky,
but I just wanted to see would it work:

https://github.com/cstamas/configuration-maven-plugin

If you want to _READ_ the config, same approach as above with lifecycle
participant would work as it receives the _effective_ model. How would you
_interpret_ the config is another story.

Thanks,
T

On Thu, Apr 28, 2016 at 10:29 AM Julien HENRY 
wrote:

> Hi guys,
>
> The SonarQube plugin for Maven try to configure SonarQube analysis based
> on Maven project configuration. We are interested by project model
> (packaging, properties) but also by configuration of other plugins
> (m-compiler-p source and target for example).
>
> Our approach to get this configuration is to read the pom using injected
> MavenProject and get an Xpp3Dom [1]. This approach is very hacky since we
> have to manually take care of all possible ways to configure a plugin:
>   - configuration can be in build/plugins or in build/pluginsManagement or
> even in reporting section
>   - I'm not sure we are supporting configuration "per execution"
>   - we are not supporting configuration provided using user properties
> (see [2])
>   - we have to hardcode default values
>
> So here is my question: is it possible for a plugin to get "resolved"
> configuration from another plugin. I mean the configuration that would have
> been injected in this other plugin at runtime.
>
> For example I would like to access value injected in compiler mojo for the
> "source" attribute [3]. I guess m2e has a similar need but I don't know how
> it works.
>
> Thanks for your help,
>
> Julien
>
>
> [1]
> https://github.com/SonarSource/sonar-maven/blob/master/src/main/java/org/sonarsource/scanner/maven/bootstrap/MavenPlugin.java#L104
> [2] https://github.com/SonarSource/sonar-maven/pull/6
> [3]
> http://svn.apache.org/viewvc/maven/plugins/tags/maven-compiler-plugin-3.5.1/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java?view=markup#l133
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
> For additional commands, e-mail: dev-h...@maven.apache.org
>
>