You're talking about the junit-test, right?

 

IIRC that's the downside of using the testing-harness over the 
maven-invoker-plugin.

You have to set every variable inside your test, no annotation/doclet parsing 
is done, so no verification nor injection is done either.

You're trying to test the *injections*, so you should really use the 
maven-invoker-plugin (or just trust Plexus, these things are tested over and 
over again)

 

To confirm that it will work: run 'mvn install -DskipTests=true' to get it into 
your local repository

create a new project, configure your plugin and run: 'mvn 
[plugins-groupId]:[plugins-artifactId]:[plugins-version]:seleniumtest

 

It should fail. 

Hence, we actually created the first project for the invoker-plugin.

You can add this project under src/it/myfirstit/. (of course a better matching 
name, please ;) )

 

please check one of the dozens of maven-plugins of org.apache.maven.plugins or 
org.codehaus.mojo, most of them use the same strategy.

 

Also please read and try the complete chapters about writing plugins. Take the 
time, soon you'll speed up while writing those plugins.

 

http://www.sonatype.com/books/mvnref-book/reference/writing-plugins-sect-plugin-descriptor.html#writing-plugins-sect-mojo-config

 

btw, it's both @parameter and @required

 

-Robert

 

----------------------------------------
> Date: Fri, 12 Aug 2011 08:41:15 -0700
> From: laredotorn...@gmail.com
> To: user@mojo.codehaus.org
> Subject: [mojo-user] @required annotation not taking effect in my Mojo
>
>
> Hi,
>
> I'm building a custom Maven plugin. I want one configuration field to be
> required, so in my Mojo I have ...
>
> /**
> * @goal seleniumtest
> */
> public class SeleniumTestMojo extends AbstractMojo {
> ...
> /**
> * @required
> */
> private String emailFrom;
>
> However when I include a configuration that doesn't contain an "<emailFrom>"
> element, my execution doesn't die (I would expect an error because the
> element is required). Am I annotating my field correctly? I have also
> tried
>
> /**
> * @parameter
> * @required
> */
> private String emailFrom;
>
> to no avail. Thanks, - Dave
> --
> View this message in context: 
> http://old.nabble.com/%40required-annotation-not-taking-effect-in-my-Mojo-tp32251321p32251321.html
> Sent from the mojo - user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email
>
>                                         
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to