From the first time I heard about Maven, to the use of Maven (part 1)

From the first time I heard about Maven, to the use of Maven (part 1)

Just came out to work, the boss said that our next project will be managed by maven, have you used it? If you haven't used it before, go back and take a look! Oh! Ok. The first reaction to this is what is maven? No, it is exactly how to write the word maven. Otherwise, even google can't search. Well, of course, just ask your friends.

well, let's get back to business.

What is Maven? Just copy this word and go to google.

From the first time I heard about Maven, to the use of Maven (part 1)

Probably explained:

Apache Maven's Project Object Model (POM), a software project management tool that can manage project construction, reports and documents through a short description of information

But these are too professional, and as a first-timer, as long as you have in your memory: I have seen this passage before.

In layman's terms, or our most commonly used function is: its management of jar packages. (Of course there are other functions, but for beginners, really, it’s enough to understand this, what you learn first, you will get a little bit, and the others will naturally know how to learn when they are used)

for example

Suppose there are 10 projects on my computer, all of which are written with SpringMVC+Spring+MyBatis (a popular open source framework). There are many jar packages in it. For example: spring-core.jar, spring-beans. jar, spring-context.jar, etc. The jar package should be imported in the usual way, and each project must have a separate copy. Then there are 10 copies of spring-core.jar in my computer, that’s not Very troublesome. What to do then? According to the basic characteristics of Java, the similar idea of ​​abstraction and encapsulation (of course a bit strong), if I put a copy in a certain directory under the computer C drive, and then everyone writes a path to reference, so only one copy is enough. Of course, there is a more important feature is that if the boss says that this jar needs another version, just change this one place. Wouldn't it be very convenient. Isn't this also a bit of Java thinking in it?

Our most commonly used maven function is for this.

Let's talk about the configuration of maven first (configuration is the basis, making a mistake, it will be very troublesome):

1. Download


http://maven.apache.org/download.cgi This address can be downloaded directly, no installation is required after decompression about 10MB

From the first time I heard about Maven, to the use of Maven (part 1)

2. Configuration

Similar to configuring java environment variables. Directly above:

From the first time I heard about Maven, to the use of Maven (part 1)

Enter mvn -version under cmd and this means OK

From the first time I heard about Maven, to the use of Maven (part 1)

3. Configure Eclipse

To use it in a project, create a maven project. Then your eclipse must first have the maven plugin.

So first install the maven plugin for eclipse

Search for the key maven in the eclipse menu bar Help->Eclipse Marketplace

Restart eclipse after installation

Then configure eclipse and local maven association

The above is the preparation work, basically just set it once (the next article will explain the use of maven in the project)

These are the basics. If you make a mistake, it will be very troublesome. Especially for newbies, the basics are wrong, and then nothing is done right, and then they will be easily discouraged

Guess you like

Origin blog.csdn.net/l1509214729/article/details/106579718