2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
Maven's common commands manage the project life cycle
Clear the target folder contents generated by compilation. You can use it with the corresponding commands in cmd, such as mvn clean package, mvn clean test
D: Work company training-4 shift day20day20untitled1>mvn clean
This command can compile the code in the src/main/java directory
D: Work company training-4 shift day20day20untitled1>mvn compile
Test command, first compile the classes in src/main/java and src/test/java, and then execute all junit test cases in src/test/java/
• Create a test class DemoTest under src/test/java
• Execute the test command to test
D: Work company training-4 shift day20day20untitled>mvn test
• The console displays the test results
mvn package, package the project
Compile first, then execute the test, and then package (only the code in main/java will be packaged. Is it the content in the compiled java package? Pay attention to the format of the compiled file after typing the code.)
So after compilation and packaging, the jar package contains .class files.
• If it is a JavaSe project, package it into a jar package
• If it is a JavaWeb project, package it into a war package
D: Work company training-4 shift day20day20untitled>mvn package
The packaged project will be found in the target directory
mvn install, package and install it in the local repository
After installation, the information that can be found in the local warehouse
life cycle:
When we execute install, we will also execute compile test package