How to build image based on parameter value?

Hi All,
I have a dockerfile that accepts arguments if I supply value as 1 it should use maven 2.0 version for base image and if I supply 2 then it should take maven latest as base image. Is this possible if so how?