About the new Maven project
Learn Maven for the first time, use eclipse + m2eclipse, and use Maven as a plug-in form. The purpose is to reduce the complexity of operating system installation of Maven and various problems in troubleshooting.
Select project type
File→New→Other→Maven Project
Select workspace
Create a workspace for the project and check use default workspace.
Select QuickStart project skeleton
Maven archetype QuickStart is selected as the project object skeleton by default.
POM three element filling
-
Fill in groupid, artifactid and version, which are the most important elements in POM!
-
These three elements define the basic coordinates of a maven project. In maven, any jar, war and POM are distinguished by these basic coordinates.
-
Groupid defines which group a project belongs to, which group is often associated with the company or organization where the project is located.
-
Artifactid defines the unique ID of the current project in the group.
-
Version sets the current version of the project. Snapshot is a snapshot, which means that the project is still under development and is an unstable version.
-
The name element is not necessary, but it is recommended to declare a name for each POM, which is more user-friendly.
-
Click Finish to generate the project automatically.
Project structure
You can see the project structure and the POM.xml Has been generated automatically.
summary
Without any actual java code, we can define the POM of a project, which reflects one of the advantages of Maven. It can make the project object model independent of the actual code to the greatest extent. We can call it decoupling or orthogonality. This largely avoids the interaction between Java code and POM code. For example, when a project needs to upgrade its version, it only needs to modify the POM without modifying the Java code; after the POM is stable, the daily java code development work basically does not involve the modification of the POM.