I have a problem with the JCommander. I want the program to throw an Exception, if the required parameter iam testing has no value. This Exception i want occurs when i forget to add a value to the last parameter.
Example(note: all Parameters are required and strings):
--user hugo --password boss --confirmPassword //no value
com.beust.jcommander.ParameterException: Expected a value after parameter --comfirmPassword
If i forget to add a value to the other parameters, the next parameter is considered as the value.
--user --password --confirmPassword hugo
//--password is considered as the value of user
In consequence of this behavior, --password can no longer be found and i get the wrong Exception.
com.beust.jcommander.ParameterException: the following options are required: --password
Is there a way to tell jCommander that he should not consider the next parameter as a value?