You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Jesse Farinacci <ji...@gmail.com> on 2012/11/01 23:16:45 UTC

maven lifecycle extension for enabling exceptions

Greetings,

I'm curious why this isn't working:

import org.apache.maven.*;
import org.apache.maven.execution.*;
import org.codehaus.plexus.component.annotations.*;
import org.codehaus.plexus.logging.*;

@Component(role = AbstractMavenLifecycleParticipant.class)
public final class ErrorMessagesExtension extends
AbstractMavenLifecycleParticipant
{
  @Requirement
  private Logger logger;

  @Override
  public void afterProjectsRead(final MavenSession session)
  {
    logger.info("Automatically enabling error message mode (-e/--errors)");
    session.getRequest().setShowErrors(true);
  }
}

Then in another pom.xml:

  <build>
    <extensions>
      <extension>
        <groupId>com.acme.maven.extensions</groupId>
        <artifactId>enable-errors</artifactId>
        <version>1.0</version>
      </extension>
    </extensions>
  </build>

It builds and is attached fine. I even see the message. However, when
an exceptional condition occurs during the build, the Maven behavior
is as if -e was not specified. I suppose I am just missing a few other
bits to turn on, but I am not seeing them in the code. Would someone
please point out to me the missing aspects?

Thanks,
-Jesse

-- 
There are 10 types of people in this world, those
that can read binary and those that can not.

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