You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by MATHUS Baptiste <ma...@mipih.fr> on 2008/03/30 16:00:22 UTC

Passing parameters to maven classes

Hi all,

I've got some small questions about plugin development. More particularly about passing parameters.
If you think this question should better be asked on the mvn-dev ML, please let me know.

I saw how to do it for a mojo: according to a declaration like this:
/**
     * @parameter expression="${project.packaging}"
     * @required
     * @readonly
     */
plexus, the IoC framework used by maven will then pass the requested -D params to the mojo.

But what about maven "core" projects (how do you call it, btw? Maven core? Non-mojo? maven api?). For example, say I want that a -Dvar=value variable be passed to some maven code that's not a mojo (wagon-provider-api, maven-artifact e.g.). Some switch that I would like to use in this maven api code.

What's the practice to do it?
Should I manage the parameter in the mojo, and then add a parameter in the non-mojo code to pass the retrieved value from the calling mojo to the api code?
Should I use some special "configurer" from plexus to inject system property directly into the api code?

Thanks a lot in advance.

Cheers.
-- Baptiste