Idea creates Maven projects (including Java projects and JavaWeb projects)

Table of contents

1. Idea creates Java project

method one

Method 2 (using generator\framework)

2. Idea creates JavaWeb project

method one

Method 2 (using generator\framework)

3.Maven plug-in creation project

1.1 Create project

1.2 Maven project build command


1. Idea creates Java project

method one

Click File-->New-->Project

 

 Creation is completed [You may need to wait for a while (because some plug-ins need to be downloaded), and the following project structure will appear]

Method 2 (using generator\framework)

Click File-->New-->Project

 Creation is completed [You may need to wait for a while (because some plug-ins need to be downloaded), and the following project structure will appear]

2. Idea creates JavaWeb project

method one

1) Create a JavaProject project first

2) Right click the mouse on the project

 

 

Method 2 (using generator\framework)

Click File-->New-->Project

 Creation is completed [You may need to wait for a while (because some plug-ins need to be downloaded), and the following project structure will appear]

3.Maven plug-in creation project

1.1 Create project

1) Open the command line at the level where the pxm.xml file is located and run the following code

1. 创建工程
    mvn archetype:generate 
        -DgroupId={project-packaging}
        -DartifactId={project-name}
        -DarchetypeArtifactId=maven-archetype-quickstart
        -DinteractiveMode=false
2. 创建java工程
    mvn archetype:generate 
        -DgroupId=com.zh
        -DartifactId=java-project
        -DarchetypeArtifactId=maven-archetype-quickstart
        -DinteractiveMode=false
3. 创建web工程
     mvn archetype:generate 
        -DgroupId=com.zh
        -DartifactId=web-project
        -DarchetypeArtifactId=maven-archetype-webapp
        -Dversion=0.0.1
        -snapshot
        -DinteractiveMode=false

Parameter Description:

  • -DgroupId : Organization name, the reverse of the company URL + project name
  • -DartifactId : project name-module name
  • -DarchetypeArtifactId : Specify ArchetypeId, maven-archetype-quickstart, create a simple Java application
  • -DinteractiveMode : whether to use interactive mode

2) After execution, the plug-ins required to execute the corresponding command will be downloaded.

3) Then open your local warehouse and you will find that your local warehouse will generate something

1.2 Maven project build command

The Maven build command starts with mvn, followed by function parameters. Multiple commands can be executed at one time, separated by spaces.

mvn compile       #编译
mvn clean         #清理
mvn test          #测试
mvn package       #打包
mvn install       #安装到本地仓库

Guess you like

Origin blog.csdn.net/qq_61902168/article/details/128046674