Introduction
With jar files you can create multiple instances of your maven project.
Clean
First you need to clean up your target files so go to the right top corner and click on Maven.
There you will be able to see the option to clean under "Project Name" > LifeCycle > clean
That will go ahead and delete all your target files.
Build
Now in the same directory under Maven, select “install” which will take care of all the aforementioned options (clean, validate, compile, test, package, verify).
This of course includes all the testing that needs to be done and the jar file will be created under target > projectName-version-SNAPSHOT.jar
Execute
In order to run the created jar files, input into your terminal:
1
java -jar target/demo-0.0.1-SNAPSHOT.jar
Or if you want to run it on another port
1
java -jar target/demo-0.0.1-SNAPSHOT.jar --server.port=8081