DEV Community

caglarcercinlidev
caglarcercinlidev

Posted on

HOW TO CREATE A JAR FILE ON A SPRING/MAVEN PROJECT

A jar file is in fact a server-runnable code.
On terminal execute this command:
mvn package
This command will build the project, run the tests and create a jar file. So be sure that all tests are passing.

After that, check the target folder, jar file will be there.

Image description

Now it is time to run this jar file. Command:
java -jar <name>.jar
With this command, the application will be running on the specified localhost port (default 8080). You can test it.

Happy coding with no errors!

Top comments (0)