The common commands of maven are as follows:
mvn -v: view maven version
mvn compile: compile
mvn test: test
mvn package: package the project, the package will be in the project's compiled file directory
mvn clean: delete compiled files
mvn install: install the jar package to the local repository
Use the maven command in Eclipse, create a new maven project, right-click the project name or pom.xml file ===>Run As===>Maven build...
A pop-up window will pop up, as follows:
Enter the maven command mentioned above in the Goals box, remember not to enter the prefix "mvn", such as: if you need to package the project, enter: package, maven will package the project, and the package will be compiled in the project. under the file directory. You can also enter multiple commands, such as: if you need to compile and delete the previous compiled files, you can enter: clean compile, enter the two names together.
If the compilation is successful, the console generally displays the following:
Common errors in compilation:
1. The compiled file cannot find the dependent package.
Solution: See if your local repository has that package, if not, check if the central repository has that package.