-
I am getting below issue once i run my test cases. picocli.CommandLine$DuplicateOptionAnnotationsException: Option name '--id' is used by both field String com.dps.core.audit.cli.ReportSubcommand.uuid and field String com.dps.core.audit.cli.Pos.sourceId
Is there any workaround exist? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
In a single command, it's not possible to have multiple options with the same name. When you say Base and subCommand, do you mean that the You need to be a bit careful in that scenario to avoid using option names in the subclass that are already used in the superclass. You'll end up with a subclass that has two separate options with the same name and picocli doesn't allow that. The only solution is to use unique option names. |
Beta Was this translation helpful? Give feedback.
In a single command, it's not possible to have multiple options with the same name.
When you say Base and subCommand, do you mean that the
subCommand
class extends theBase
class, so thesubCommand
command inherits all options declared in theBase
class?You need to be a bit careful in that scenario to avoid using option names in the subclass that are already used in the superclass. You'll end up with a subclass that has two separate options with the same name and picocli doesn't allow that.
The only solution is to use unique option names.