0

Basically I need my plugin to run POST maven execution, not matter which phases were executed, but I learned to know that this is not possible and I must attach my plugin to a particular phase :-(.

But... I can do it by myself if I'll attach my plugin to every possible phase and extract the last phase to be executed from within the plugin, then by simple comparison to the current phase I will know to tell if this is really the last phase or not. If it's the last phase I will execute my plugin code.

Someone knows how I can extract this information?

Thanks, Shay

Shay Tsadok
  • 913
  • 1
  • 7
  • 26

1 Answers1

1

Maven supports pre and post scripts. See the accepted answer here. In your case it would be mavenrc_post.bat

You can easily do that by creating a file at /etc/mavenrc or ~/.mavenrc (Linux) or %HOME%\mavenrc_pre.bat (Windows) Maven executes those on startup if they exist unless you've defined a variable named MAVEN_SKIP_RC.

Community
  • 1
  • 1
pjanssen
  • 1,065
  • 13
  • 35
  • Thanks for the tip. I did not know that... At the end I used a little trick that works fine to me which is replacing Maven's ExecutionListener. You can see the code here: https://github.com/HPSoftware/maven-dev-monitoring/tree/master/src/main/java/com/hp/qc/mavenmonitoring – Shay Tsadok Jul 13 '15 at 12:58