Re: proper format for mult-value options.
Slawomir Jaranowski <[email protected]> Thu, 28 May 2026 18:56:07 +0200
| Newsgroups | gmane.comp.jakarta.turbine.maven.devel |
|---|---|
| Message-ID | <CAGjJkv0bQJNPk7WMi2rhhOyPpqpZNA54x0KkpNMF57REa9aokQ@mail.gmail.com> |
On Thu, 28 May 2026 at 18:03, Claude Warren <[email protected]> wrote: > > I am working on the RAT Maven Mojo and have a question about structuring > options. > > In RAT we have the ability to explicitly include and exclude files (as one > would expect). So I have defined <inputExcludes> and <inputIncludes>. > These options then take 1 or more file patterns. > > For example: > > <inputIncludes> > <pattern>**/*.txt<pattern> > <pattern>**/*.md</pattern> > </inputIncludes> > <inputExcludes> > <pattern>target/**</pattern> > <inputExcludes> > > My questions are: > > > 1. What is the Maven standard pattern for options that take multiple > arguments? > 2. Is the above example possible? > 3. Should "pattern" be replaced wiih "inputExclude" and "inputInclude" > respectively? For simple collection parameter you can use arrays [] or collection like List > 4. Does Maven support something like: > > <inputIncludes> > <pattern>**/*.txt<pattern> > <pattern>**/*.md</pattern> > <scm>GIT<scm> > </inputIncludes> > > Where "scm" represents a different type of option. Ant has this concept > but I don't see it in Maven. > yes with more tricky ... for your example create ------------------- public interface InputType {} next class for each item type public class Pattern implements InputType { // set method will be called with value from tag public void set(String value) { ... } } public class Scm implements InputType { public void set(String value) { ... } } ------------------- Next parameter in mojo: @Parameter private List<InputType> inputIncludes You will have a list <inputIncludes> with items of type which were used in config. https://maven.apache.org/guides/mini/guide-configuring-plugins.html#mapping-collection-types > Thank you for your attention, > Claude > > > > > -- > LinkedIn: http://www.linkedin.com/in/claudewarren -- Sławomir Jaranowski