Day12JavaWeb 【Maven】 idea 与 maven ***

Maven's idea configuration***

Insert picture description here

  • (1) Common configuration
    File —>settings —>Search maven —>Specify maven directory, configuration file path, local warehouse path
    Insert picture description here

Set VM options in MavenRunner as: -DarchetypeCatalog=internal

  • (2) Default configuration:
    File—>other setting—>Default Settings—>Search Maven—>Specify maven directory, configuration file path, local warehouse path
    File—>other setting—>Default Settings—>Search for Maven—>Maven Runner—>Set VM optionsto:-DarchetypeCatalog=internal
    Insert picture description here

Maven creates a JavaSe project

  • (1) How to create a JavaSE module in Maven
    " "1 File ----new Project ----> check create from archetype —> select: xxxx.quickstart
    "" 2 Specify a coordinate for the project to be created currently, because I am this The project can also be packaged into a package and released to the warehouse in the future, you must specify 坐标
    》》3 After creating the project, be sure to click on Event-Log in the lower right corner: Import Changes Enable Auto-Import, which can automatically import the jar package from the warehouse

Maven creates a JavaSe project directory

(1) The directory structure of the project

Insert picture description here

(2) Problem
If it is stuck in: loading archetype list when it is created,
delete: C:\Users\your user name.IntelliJIdea\system\maven directory, and then restart idea

Maven creates JavaWeb project***

(1) How to create a JavaWeb module in Maven?
》》1 File ----new Module ---->Check create from archetype
》》2 Select: xxxx.quickstart The third option below: xxx.webapp
》》3 Set the module name: day11_01_web

Introduction to Maven's web project directory***

(1) Directory
Insert picture description here

Create multiple web projects in Project***

》》1 Create Project and select quickstart (choose to use maven template)
》》2 Select Project, then new Module select webapp

Insert picture description here

The pom.xml file of the Maven project***

pom.xml file

  • (1) Jar package dependency
    If we need to use a jar, we only need to configure it in pom.xml
    (2) Plug-in

Maven project commands

  • (1) Maven comes with some commands for project management:
    clean: clear the project compilation files, delete the target folder under the project
    compile: recompile the project, generate the target folder
    package under the project : change the current The project is marked as war/jar package under the target folder, and the war package can finally be published on the Linux server
    install: publish the current project to the local warehouse
    test: execute the test program

Guess you like

Origin blog.csdn.net/u013621398/article/details/108726128