Hi,

hope this is the correct channel to respond to this question.

I'm building a Maven plugin whose every action take around 75 possible
flags (and counting).

To help with compartmentalizing all this configuration, I created Java
classes to hold the configs for each goal (e.g., DeployConfig, RunConfig,
etc.). It makes pom.xml look much better, but the downside is that
specifying parameters on the command line becomes a bit complicated.

According to this
<http://blog.sonatype.com/2011/03/configuring-plugin-goals-in-maven-3/#.Vuba4qgrJE4>
article, if my parameter isn't of a simple type, collection of array, I'm
only left with the set(String args) method. I don't want to pass all args
in a single String and then parse it, so I thought of having a DeployConfig
and all the parameters inside it at the Mojo level. That would result in
stuff like:

<deployConfig>
  <bucket>this bucket</bucket>
<deployConfig>
<bucket>that bucket</bucket>

Where I'd have to add priorities and it would also get complicated.

Finally, since the mvn call sets system properties with -D, I'm thinking of
going over System.getProperties() at the beginning of my Mojo.execute() and
override the pom.xml values with the ones in the command line.

1) This gets rid of all @Parameter annotations except one, and we're
getting actual parameters hiding from Maven. Is there any automation by
Maven that uses those annotations and that we might be missing on?

2) Is there a better way to accomplish Complex Object parameters through
command line?

Thanks a lot for your time,
joão

-- 
João André Martins | Technical Solutions Engineer - Cloud Platform |
joaomart...@google.com | +1 650-214-7143

Reply via email to