I have a standard JCommander parameter which works fine when running the jar locally or through IntelliJ, but as soon as I try and load it through a dockerfile it returns:
Exception in thread "main" com.beust.jcommander.ParameterException: Was passed main parameter '-profile ${PROFILE}' but no main parameter was defined in your arg class
The code I'm loading the args through:
@Data
public static class Args {
@Parameter(
names = {"-profile", "-p"},
arity = 1,
required = true)
private String profile;
}
I'm parsing that via:
JCommander.newBuilder().addObject(ARGS).build().parse(args);
The entry point command I have in my Dockerfile:
ENTRYPOINT ["java" , "-jar", "/usr/app/app.jar", "-profile ${PROFILE}"]
Finally I'm just starting the container the usual way with ...-e PROFILE=dev
Is there something obvious I've missed here, do I just need to escape quotes somewhere or something?