I would get around this by having a Mojo property of type String and
then pass comma-separated list to it - should work from both command
line and pom.xml configuration.
No doubt there is some boiler-plate involved to create a File array but
a.t.m seems like the only work around IMHO.
I'd be interested if any one else has a cleaner solution that works both
for CLI and pom.xml.
HTH,
Rahul
----- Original Message -----
From: "Wayne Fay" <[EMAIL PROTECTED]>
To: "Maven Users List" <[email protected]>
Sent: Wednesday, April 19, 2006 3:11 PM
Subject: Re: Mojo File array parameter and system properties
First off, I haven't done a lot of Maven plugin development, so take
this with a grain of salt.
I don't believe this error is simply due to the fact that you're
trying to pass a string value into a File property. I think its also
because your mojo is expecting an array of files.
Other people have asked how to pass in an array of values from the
command line on this list, and the general response was "you just
can't".
So I'd just plan on putting all your file values etc in the pom.xml
file itself for this mojo, and not trying to pass the properties thru
the command line.
Wayne
On 4/18/06, Beyer,Nathan <[EMAIL PROTECTED]> wrote:
I'm building a Maven 2 Plugin (as a MOJO) and I have a parameter
that's
a java.io.File array and I'm trying to figure out how I would create
an
expression for passing this as a system property. Currently, the
parameter is configured as follows.
/**
* <p>
* The list of report file paths (relative to the project root).
* </p>
*
* @parameter expression="${reportPaths}"
* @required
*/
private File[] reportPaths;
The parameter will get setup as I expect (an array of File instances)
when I use either of the following configurations in a POM.
<configuration>
<reportPaths>
<reportPath>test_report_1.xml</reportPath>
</reportPaths>
</configuration>
<configuration>
<reportPaths>
<java.io.File>test_report_1.xml</java.io.File>
</reportPaths>
</configuration>
How would I setup this parameter via a System Property on the command
line? I've tried a couple of things, like the following, but I get an
error about not being able to assign the entry because the input is a
String and the expected class is a File[].
mvn mygroup:myartifact:mygoal -DreportPaths=test_report_1.xml
Additionally, I've tried changing the type to an ArrayList and can
setup
the parameter via the POM, but I still can't get the system property
to
parse anything.
Any suggestions? Are there any documents for plugin development that
are
more detailed than the Mojo API, the development mini guide and the
configuring a plugin mini guide? I've tried searching, but I haven't
found much.
Thanks.
-Nathan
-----------------------------------------
CONFIDENTIALITY NOTICE This message and any included attachments
are from Cerner Corporation and are intended only for the
addressee. The information contained in this message is
confidential and may constitute inside or non-public information
under international, federal, or state securities laws.
Unauthorized forwarding, printing, copying, distribution, or use of
such information is strictly prohibited and may be unlawful. If you
are not the addressee, please promptly delete this message and
notify the sender of the delivery error by e-mail or you may call
Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1)
(816)221-1024. -------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]