Массивы строк как параметры командной строки для плагина знатока

Не точно, но можно сказать List<object>, и вещи будут работать. Однако list[0].Id не будет работать.

Это будет работать во времени выполнения в C# 4.0 при наличии List<dynamic>, который является Вами, не получит IntelliSense.

18
задан Guss 9 September 2009 в 18:58
поделиться

1 ответ

You can't do it directly as far as I know, but it is pretty common practice to accept a delimited String and split that into an array yourself.

For example the maven-site-plugin allows you to specify a comma-delimited String of locales, while the maven-scala-plugin handles this by allowing you to define the arguments with a pipe separator. You can look at the relevant Mojos to see how the argument is processed.

Some example usages below:

site-plugin:

-Dlocales=enGB,frFR

scala-plugin:

-DaddArgs=arg1|arg2|arg3

Update: if you want to handle this more elegantly, you could use maven-shared-io to allow definition of an external descriptor file, then pass the descriptor location as a property. This means a single command-line argument can reference a structure of configuration.

If this sounds like it might work for you, have a look at this answer that describes how to use external descriptors in the properties plugin, or this answer that does similar for the xml-maven-plugin. Or you can just look at the assembly-plugin for ideas.

10
ответ дан 30 November 2019 в 08:58
поделиться
Другие вопросы по тегам:

Похожие вопросы: