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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to