You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Hiroki Kondo <ko...@gmail.com> on 2012/08/13 12:16:06 UTC

How can I make a maven plugin to notify build results?

Hi,

I develop a simple plugin to notify build results to desktop like growl.
https://github.com/kompiro/notification-maven-plugin

Now, I think there are no good way to listen build result event.
I tested two way to listen the event.

a. ExecutionListener from MavenSession#getRequest()

This way is implemented below.
https://github.com/kompiro/notification-maven-plugin/blob/master/src/main/java/org/kompiro/nortification/buildresult/NotificationMojo.java

This way is running well to notify, but there is a problem. It
replaced default maven event execution listener. So, if user add this
plugin, there are no maven execution log. I thought my implementation
extends the default event execution listener "ExecutionEventLogger",
But I can't because The constructor of ExecutionEventLogger needs
plexus's logger. I can't get the logger object.

b. use EventSpy

This is not public interface and user must add the plugin to maven.ext
classpath.It is not good for user.

How can I listen the event correctly?

(Sorry for multi posting:
http://stackoverflow.com/questions/11923356/how-can-i-make-a-maven-plugin-to-notify-build-results/11930324#11930324
)

-- 
Hiroki Kondo
kompiro@gmail.com

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


Re: How can I make a maven plugin to notify build results?

Posted by Hiroki Kondo <ko...@gmail.com>.
Hi, htfv

Thanks for your reply.
I got a mail like your idea privately and I implemented the delegation
listener using Proxy.

I released the plugin to my maven repository.
https://github.com/kompiro/notification-maven-plugin

Regards,
Hiroki

On Mon, Aug 20, 2012 at 8:35 PM, Aliaksei Lahachou
<al...@gmail.com> wrote:
> Hi,
>
> You may replace execution listener with your listener and delegate events
> to the previous listener. You may inherit your listener from something like
> this: [1].
>
> BTW, I've never seen that Maven sets some default execution listener, it
> was always null in my tests. Can someone confirm if it is used internally
> by the Maven?
>
>
> [1]
> https://github.com/htfv/build-configurator/blob/master/build-configurator-core/src/main/java/com/github/htfv/maven/plugins/buildconfigurator/core/DelegatingExecutionListener.java
>
>
> Regards,
> htfv (Aliaksei Lahachou)
>
>
> On Mon, Aug 13, 2012 at 12:48 PM, Hiroki Kondo <ko...@gmail.com> wrote:
>
>> Hi,
>>
>> I develop a simple plugin to notify build results to desktop like growl.
>> https://github.com/kompiro/notification-maven-plugin
>>
>> Now, I think there are no good way to listen build result event.
>> I tested two way to listen the event.
>>
>> a. ExecutionListener from MavenSession#getRequest()
>>
>> This way is implemented below.
>>
>> https://github.com/kompiro/notification-maven-plugin/blob/master/src/main/java/org/kompiro/nortification/buildresult/NotificationMojo.java
>>
>> This way is running well to notify, but there is a problem. It
>> replaced default maven event execution listener. So, if user add this
>> plugin, there are no maven execution log. I thought my implementation
>> extends the default event execution listener "ExecutionEventLogger",
>> But I can't because The constructor of ExecutionEventLogger needs
>> plexus's logger. I can't get the logger object.
>>
>> b. use EventSpy
>>
>> This is not public interface and user must add the plugin to maven.ext
>> classpath.It is not good for user.
>>
>> How can I listen the event correctly?
>>
>> (Sorry for multi posting:
>>
>> http://stackoverflow.com/questions/11923356/how-can-i-make-a-maven-plugin-to-notify-build-results/11930324#11930324
>> )
>>
>> --
>> Hiroki Kondo
>> kompiro@gmail.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>



-- 
Hiroki Kondo
kompiro@gmail.com

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


Re: How can I make a maven plugin to notify build results?

Posted by Aliaksei Lahachou <al...@gmail.com>.
Hi,

You may replace execution listener with your listener and delegate events
to the previous listener. You may inherit your listener from something like
this: [1].

BTW, I've never seen that Maven sets some default execution listener, it
was always null in my tests. Can someone confirm if it is used internally
by the Maven?


[1]
https://github.com/htfv/build-configurator/blob/master/build-configurator-core/src/main/java/com/github/htfv/maven/plugins/buildconfigurator/core/DelegatingExecutionListener.java


Regards,
htfv (Aliaksei Lahachou)


On Mon, Aug 13, 2012 at 12:48 PM, Hiroki Kondo <ko...@gmail.com> wrote:

> Hi,
>
> I develop a simple plugin to notify build results to desktop like growl.
> https://github.com/kompiro/notification-maven-plugin
>
> Now, I think there are no good way to listen build result event.
> I tested two way to listen the event.
>
> a. ExecutionListener from MavenSession#getRequest()
>
> This way is implemented below.
>
> https://github.com/kompiro/notification-maven-plugin/blob/master/src/main/java/org/kompiro/nortification/buildresult/NotificationMojo.java
>
> This way is running well to notify, but there is a problem. It
> replaced default maven event execution listener. So, if user add this
> plugin, there are no maven execution log. I thought my implementation
> extends the default event execution listener "ExecutionEventLogger",
> But I can't because The constructor of ExecutionEventLogger needs
> plexus's logger. I can't get the logger object.
>
> b. use EventSpy
>
> This is not public interface and user must add the plugin to maven.ext
> classpath.It is not good for user.
>
> How can I listen the event correctly?
>
> (Sorry for multi posting:
>
> http://stackoverflow.com/questions/11923356/how-can-i-make-a-maven-plugin-to-notify-build-results/11930324#11930324
> )
>
> --
> Hiroki Kondo
> kompiro@gmail.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

How can I make a maven plugin to notify build results?

Posted by Hiroki Kondo <ko...@gmail.com>.
Hi,

I develop a simple plugin to notify build results to desktop like growl.
https://github.com/kompiro/notification-maven-plugin

Now, I think there are no good way to listen build result event.
I tested two way to listen the event.

a. ExecutionListener from MavenSession#getRequest()

This way is implemented below.
https://github.com/kompiro/notification-maven-plugin/blob/master/src/main/java/org/kompiro/nortification/buildresult/NotificationMojo.java

This way is running well to notify, but there is a problem. It
replaced default maven event execution listener. So, if user add this
plugin, there are no maven execution log. I thought my implementation
extends the default event execution listener "ExecutionEventLogger",
But I can't because The constructor of ExecutionEventLogger needs
plexus's logger. I can't get the logger object.

b. use EventSpy

This is not public interface and user must add the plugin to maven.ext
classpath.It is not good for user.

How can I listen the event correctly?

(Sorry for multi posting:
http://stackoverflow.com/questions/11923356/how-can-i-make-a-maven-plugin-to-notify-build-results/11930324#11930324
)

-- 
Hiroki Kondo
kompiro@gmail.com

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