The simplest solution:
<artifactId>Example</artifactId>
<version>1.0</version>
<properties>
<jarName>${project.artifactId}-${project.version}</jarName>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<finalName>${jarName}</finalName>
</configuration>
</plugin>
</plugins>
</build>
Which results in:
mvn clean package -DjarName=123
-> target/123.jar
mvn clean package
-> target/Example.jar