Recently, I learned how to use Maven on the MOOC online, and recorded the approximate content as follows:
Directory Structure:
src --main --java <- build source code structure (including package name) in this directory --test --java <- Test code to build source code in this directory --resource
Common commands:
- mvn compile compile source code
- mvn test compiles and runs test code
- mvn package packages the class files of the source code
- mvn clean clears all the results of the previous mavn execution (that is, deletes the target directory under the same level of src)
- mvn install compiles and packages the source code and saves the packaged package to the local repository