“This is the 21st day of my participation in the First Challenge 2022. For details: First Challenge 2022”

Maven Environment Installation

First of all, MY operating system is Window10, and I choose IDEA as my editor. Ubuntu doesn’t matter either, it’s all the same, because if we use IDEA, it has a Maven built in, so basically, you don’t need to do any extra work, unless of course you’re not happy with the current version of Maven. If you are, then you can choose to configure IDEA maven as a native Maven. (PS HERE is the 2021 version, the built-in version is 3.6.3)

Open your idea, go to Settings, and find Maven, where all the parameters are explained.

Then find maven in our IDEA, and find your installation directory (IDEA).

At this point, you can also choose to copy and extract the Maven, which I won’t bother to do here.

Then you configure the environment variables, and you can use this thing as a system.

And then that’s it. Check it out

So the basic environment is actually fine.

Then you configure the mirror, which is the repository. This can also be configured directly in config.

You can see that I have configured Ali cloud here. Of course, you can also modify the address of your local warehouse.

Or, you can set it directly in IDEA.

This is the default and can be seen in IDEA

So this is not to say, these things are baidu, there is no meaning to record here.

The project structure

We create maven projects directly in IDEA, and then the whole project looks like this.

On the right are various plug-ins

Maven command

What about this one? This one saw this

Here are a few things, so our Maven has several commands that are executed directly in your project root directory for example

MVN compile compiles

So basically it’s pretty easy to use Maven, but I’m not talking about that at all. I’m talking about configuration dependencies that are important in springBoot’s micro development.

Of course you might say THAT I’m tying idea too much, but I would say that basically any editor has this type of plugin to help you build projects this quickly. If you charge for IDEA, you can use VScode for this project. I used VScode to write Java and Maven officially provides this plug-in to generate this project.

(of course, they require java11 or higher, the old version of the plugin is no longer available, my original Ubuntu is vscode, of course, you have to use vim that I have no choice, I used to like to do things like arch Linux, and other things, but it is a fancy work, how convenient it is, After all, it’s a tool that shows a programmer how good he is, and I don’t see much use in asking about anything other than algorithms and problem solving, unless I’m asking about something that’s really important like having a deep understanding of Spring and maybe building your own wheels. Otherwise, I really don’t see the point, otherwise, I wouldn’t go to that company, it’s a business “moving” company)

Pom file

We will focus on our POM file, which we used to create a standard Maven project with IDEA

This is a standard POM file

Of course, there are many details of the operation, I was not said, it is completely baidu, my blog is my own oriented, just the use of cloud notes.

dependencies

Depend on the transfer

The first is the dependence between brother projects. Remember this thing

<groupId>org.example</groupId>
<artifactId>SpringFrame</artifactId>
<packaging>pom</packaging>
<version>1.0 the SNAPSHOT</version>
Copy the code

This started as a declaration of our own project, so in the brother project, this can be used directly. As a dependency.

It’s only possible because you have this thing in your local warehouse.

Of course, there is a priority between them

Optional dependence

Sometimes, we don’t want all of it, or I don’t want people to know that I use those things, so I can do that.

Depend on the range

This is very important, for example, if we don’t use something, or don’t pack it, or test files don’t work.

The life cycle

I should add that the full project cycle looks like this

So basically this is the most basic thing to use and understand, and of course there are a lot of details that are blocked out (I don’t want to write it, I don’t need to write it, you’ll know when you use it)

There are modular split, aggregation and so on, these should be combined with the specific project, I can not say here.