String arrays as command line arguments for maven plugin

后端 未结 5 1169
轻奢々
轻奢々 2020-12-06 16:35

I\'m writing a maven plugin that has a parameter that\'s a String[].

Like this:

/**
* @parameter expression=\"${args}\"
*/
protected String[] args;
<         


        
5条回答
  •  攒了一身酷
    2020-12-06 17:23

    According to Sonatype's blog here, if you are a plugin developer and

    1. use Maven 3

    2. and annotate your array/collection type plugin parameter using annotation like:

      /** @parameter expression="${args}" */

    In this way, the plugin parameter can be processed by Maven automatically and plugin users can provide the plugin array/collection type parameters via CLI using a comma separated system property like mvn myplugin:mygoal -Dargs=a,b,c

提交回复
热议问题