Option One:
First of all, idea comes with a maven control. Unlike Eclipse, you need to download the control. If you used to have maven on the right side, but for some reason it disappears and cannot be found, you can try the method I wrote.
Method 1. Click on the small box in the lower left corner of your idea interface. Maven should be found from inside.
Method 2. Click View->Tool Windows->Maven projects in the menu bar
Method 3. Click Help->Find Action (Ctrl+Shift+A) in the menu bar and enter Maven projects
Option II:
Maven does not appear in the right sidebar. Another possibility is that the pom.xml file is not recognized. Idea thinks that this project is not a Maven project, causing Idea to be unable to load dependency packages. Therefore, the above three methods are useless. Solution: Right-click the pom.xml file and click "add as maven project"
The following is a brief introduction to the basic usage of Lifecycle in IDEA's maven project.
What is Maven?
Maven is a build automation tool primarily used for Java projects. Maven can also be used to build and manage projects written in C#, Ruby, Scala, and other languages.
What is the Maven build life cycle?
-
1.clean
Used to clear all files generated by previous builds
Specifically, all files in the Target directory are cleared, including this directory
For example: deleted all files generated by install
-
2.validate
Verify that the project is correct and all necessary information is available
-
3.compile
Compile the source code of the project, mainly java files
Generally, the files in scr/main/java or scr/test/java are compiled.
-
4.test
Use an appropriate unit testing framework to test the compiled source code and test the code compiled in compile
Testing generally does not require packaging or deployment code
-
5.package
Get the compiled code in compile and package it into a classifiable format
For example JAR
-
6.vertify
This step is used to verify the test and check the test results.
Check whether the test results meet the standards
-
7.install
Install packages into local repository
Used as a dependency for other local projects (note: oms can be used only after core is installed)
-
8.deploy
Done in the build environment, copy the final package to a remote repository for sharing with other developers and projects.
Remarks; PS: Garbled characters may appear during installation. At this time, right-click on install and select create xxx install
在command line里写 install -Dmaven.test.skip=true -f pom.xml 然后用新写的命令代替旧的install即可
What are Maven build goals?
The build phase consists of a set of goals. Maven goals represent specific tasks that help build and manage a project.
Sometimes, Maven goals are not limited to the build phase. We can execute these goals through the command line.