maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Giuseppe.Gr...@b-source.ch>
Subject Base Abstract Mojo
Date Thu, 17 Jun 2010 17:07:36 GMT
Dear all,

I created a base abstract mojo like this:

public abstract class MyAbstractMojo extends AbstractMojo {

    /**
     * @parameter expression="${outputDirectory}"
default-value"${project.build.directory}"
     */
    protected File outputDirectory;

    /**
     * {@inheritDoc}
     */
    public void execute() throws MojoExecutionException {

        executeImpl();
    }

    /* derived classes just implement this */
    protected abstract void executeImpl() throws MojoExecutionException;
}

When I try to access parameter outputDirectory from a derived mojo, I
get a NullPointerException... so the question is: how can I define a
parameter in base class and then use it an all the derived classes?

Thanks,
Jeff
Giuseppe Greco
Application Architect - System Integration & Applications
B-Source SA
Via Rinaldo Simen 14, P.O.BOX 4648 CH-6904 Lugano
Tel. +41 (0)58 806 56 42 - fax +41 (0)58 806 50 01
giuseppe.greco@b-source.ch - www.b-source.ch
P Think before you print

IMPORTANT: 
This e-mail transmission is intended for the named 
addressee(s)only. 
Its contents are private, confidential and protected 
from disclosure and should not be read, copied or
disclosed by any other person. 
If you are not the intended recipient, we kindly ask
you to notify the sender immediately by telephone 
(+41 (0)58 806 50 00), to redirect the message to the 
account "info@b-source.ch" and to delete this e-mail.
E-mail transmissions may be intercepted, altered or 
read by unauthorized persons and may contain viruses.
Therefore, it is recommended that you use regular mail
or courier services for any information intended to be 
confidential. However, by sending us messages through
e-mail, you authorize and instruct us to correspond by 
e-mail in the relevant matter. 
Thank you.


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


Mime
View raw message