Using Maven to print directly running jar package


Add the following contents to the POM file under the project > build > plugins node


Mainclass is your program entry main method.

Then go to the project directory and run:

mvn clean compile assembly:single 

If there are no errors, after compiling, there will be a file named XXXX jar with- dependencies.jar The file is lying quietly under the target folder.

java -jar xxxx-jar-with-dependencies.jar

You can run it directly.

Recommended Today

Rust and python: why rust can replace Python

In this guide, we compare the rust and python programming languages. We will discuss the applicable use cases in each case, review the advantages and disadvantages of using rust and python, and explain why rust might replace python. I will introduce the following: What is rust? What is Python? When to use rust When to […]