In Apache Maven 3.5.4, I had to add double quotation. Without double quotation it wasn't worked for me.
example:
mvn install:install-file "-Dfile=location to the jar file" "-DgroupId=group id" "-DartifactId=artifact id" "-Dversion=version" "-Dpackaging=package type"