Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How IDEA installs and configures Maven and manages it uniformly

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "how IDEA installs and configures Maven and manages it uniformly". The explanation content in this article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian to study and learn "how IDEA installs and configures Maven and manages it uniformly".

directory

1. Maven installation

2. Maven Configuration

3. IDEA Global Configuration Maven

4. Maven Unified Management

6. Submodule dependency management

1. Maven installation

Download: https://maven.apache.org/download.cgi

Extract the file and store it by yourself, and create a new folder under the maven storage directory you just downloaded: maven-repository , which is used to store local jar packages.

2. Maven Configuration

In the maven installation directory: find the conf/settings.xml file (no open software, available Notepad open) found

/path/to/local/repo

localRepository node is commented out by default. You need to move it out of comments and change the localRepository node value to the new maven-repository folder directory.

3. IDEA Global Configuration Maven

Open IDEA and click Configure==>Settings as shown below

This is the global configuration. After creating a new project, this setting is applied by default. After entering, the configuration is as shown below.

4. Maven Unified Management

For those of you who don't know what a father-son module is, read my other blog post.

IDEA Creating SpringBoot Parent-Child Modules

Under the pom.xml file of the parent module

Create dependencies node, directly add dependencies in the dependencies node is directly owned by each child module project, simply put, if a child module its parent module in the parent module pom.xml file under the dependencies node, the child module also has, no need to introduce dependencies!

1.8 2.3.1.RELEASE org.springframework.boot spring-boot-starter-web ${spring.boot.starter.version}

When adding dependencies, the version is no longer specified, but the version is specified in the properties node, and the version is managed uniformly.

6. Submodule dependency management

Figure pom.xml for parent module, which means this parent module has two child modules

If dependencies under the dependencies node are needed in projects in the modules submodule, the pom.xml of the submodule will not need to add any dependencies

Parent-child module configuration

In the parent module pom.xml file, create a dependencyManagement node where dependencies are only used to manage the version of the child module project when dependencies are used

org.projectlombok lombok true ${lombok.version}

As shown above, if the child module also needs this dependency, you only need to configure this dependency under the dependencies node under the pom.xml file of the child module, and there is no need to configure the version node, so that this dependency uses the version number configured for the parent module.

The dependencies of the submodules are as follows:

org.projectlombok lombok true

Summary: If a large number of modules need to use the same dependency, you can put this dependency under the dependencies node under the parent module pom.xml file. On the other hand, if only one of the child modules needs to be used, then you can put this dependency under the dependencyManagement node. Don't forget that the child modules under this node still need to import dependencies, but you don't need to configure the version number again.

Thank you for reading, the above is "IDEA how to install and configure Maven and unified management" of the content, after the study of this article, I believe we have a deeper understanding of how IDEA install and configure Maven and unified management of this issue, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report