You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Hilco Wijbenga <hi...@gmail.com> on 2012/07/03 19:25:11 UTC

Maven Extension: How to finish the build successfully and immediately?

Hi all,

I have created a Maven extension that goes through the list of
projects about to be built and eliminates the unnecessary ones. This
is working fine. However, when running the same build twice (without
source changes in between), all projects are removed which causes
Maven to die with an error message.

How can I cleanly (so with result SUCCESS) abort the build upon
discovering no work needs to be done?

Cheers,
Hilco

P.S. Combining AbstractMavenLifecycleParticipant and EventListener
makes it very easy to build quite powerful Maven extensions. Very
nice!

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


Re: Maven Extension: How to finish the build successfully and immediately?

Posted by Hilco Wijbenga <hi...@gmail.com>.
On 3 July 2012 10:25, Hilco Wijbenga <hi...@gmail.com> wrote:
> I have created a Maven extension that goes through the list of
> projects about to be built and eliminates the unnecessary ones. This
> is working fine. However, when running the same build twice (without
> source changes in between), all projects are removed which causes
> Maven to die with an error message.
>
> How can I cleanly (so with result SUCCESS) abort the build upon
> discovering no work needs to be done?

This does not appear to be possible.

For those interested, my workaround is to create a new, empty project
and supply only that project to Maven instead of the empty list.

final MavenProject dummyProject = new MavenProject();
dummyProject.setArtifactId("nothing");
dummyProject.setVersion("(everything is up-to-date).");

This then outputs

<snip/>
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building nothing (everything is up-to-date).
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
<snip/>

So not perfect but close enough. :-)

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