Idea creates a maven project (module combination)

1. Idea configuration maven environment

1.1 Configure maven path, local warehouse

 File —>settings —>Search maven —>Specify the maven directory, configure the maven path, the local warehouse path
(Local repository: local repository, the package downloaded from the central warehouse can be found in this folder)
Insert picture description here

1.2 Solve the problem of slow build when creating a maven project

  (Because plug-in resources are downloaded when the project is built, which makes the initial build time-consuming.
Solution : Set the VM options value in the Runner under Maven:-DarchetypeCatalog=internal
Insert picture description here


2. Maven creates JAVASE project

  1. File —> new Project —> select the maven project —> check create from archetype —> select quickstart
    Insert picture description here
  2. Specify a coordinate for the project to be created, because my project can be packaged into a package and released to the warehouse in the future, you must specify the coordinate.
  3. After creating the project, be sure to click on Event-Log in the lower right corner: Import Changes Enable Auto-Import, you can automatically import the jar package from the warehouse

2.1 Maven creates the directory structure of the JAVASE project

Insert picture description here

3. Maven creates a javaweb project (create multiple mavens in a Project) [***]

  1. Create an empty project to create a project (you can choose quickstart as a maven template)
  2. Then on the new Module of the created project, select the webapp project and
    Insert picture description here
    create it successfully:
    Insert picture description here

3.1 Maven creates the directory structure of the javaweb project

Insert picture description here

4. Commonly used commands for maven projects

Insert picture description here
Maven comes with some commands for project management:

maven command description
clean Clear the project compilation files, delete the target folder under the project
compile Recompile the project and generate the target folder under the project
package Mark the current project into the war/jar package target folder, and finally publish the war package to the Linux server
install Publish the current project to the local warehouse
test Execute test program

Guess you like

Origin blog.csdn.net/qq_40542534/article/details/108745537