Maven entry point into the [white] do not

Once a girl asked me why I want to learn Maven, I would hate Baji mouth: Maven project does not jar package it is not fragrant Well, it still does not run Hong thing? If I had a word to describe Maven, I would describe this: "Mom no longer have to worry about Xiao Ming to take the U-jar roasted red computer bag," and the girls listened to the collapse instantly tears: "I am actually a central warehouse, after missing jar package come to me directly, do not need red, "I suddenly felt rather flattered rattling deer ~ ~.

Entered, when in fact a framework for development will inevitably encounter the hell called Maven, the emphasis at this reading, "Mei Man", but not "Marvin" or what "Mom plague" What blast, read with like the plague. I would think after reading, you basically mastered the Maven half, do not feel exaggerated, because Maven is really good to learn (or be read to grasp half of an exaggeration), but also to read some science than the total addition of several months every day. " mom plague "of much easier. Well, do not pull a calf, and directly on the dry!

What is Maven

A brother more formal definition of Maven says so: Maven is a project management tool which encompasses a project object model, a set of standards, a project life cycle, a dependency management system, and to run in the definition logic plug-in life cycle stage of the target. I was listening to laugh, Maven does not jar on a management package can automatically download the coordinates directly on the tool corresponding jar package Well, what Rory it repetitious definition Well, pretend to be installed (momentum this regard, I have not served who had), but this is my brother summed up pretty good, immediate, complete text of the table, delicious! (Behind his second counseling ~ ~)

Maven can solve any problem

Well, I say a few more popular way of explanation, Ge Jige feel: project development is not just writing code for it, accompanied by a variety of essential things to do during this time, the problem to 1, we need to refer to a variety of jar package, especially large projects, often cited jar package there are dozens or even hundreds, each use one kind of jar package, you need to manually introduced into the project directory, and often jar package conflicts encountered all kinds of people crazy, version conflicts.

2, we worked so hard to write a Java file, but only know how to 0 and 1 is completely idiot computer can not read, it needs to be compiled into a binary byte code. Anyhow, now this work can help us from a variety of integrated development tools to complete, Eclipse, IDEA and so can be the code-time compilation. Of course, if you think life long, why not extravagant, you can also use Notepad to knock code, and then use the javac command to compile one by one, funny computer to play.

3, bug-free code does not exist in the world, like a computer bug on and people always like the same beautiful guy. In order to reduce the pursuit of beauty bug, and therefore the code is finished, we have to write some unit tests, and then run one by one to verify code quality.

4, another elegant code is to be sold out. We also need to back the code and various configuration files, resource integration together, stereotypes package, if it is web project, you also need to publish it to the server, for people devastated. Just think, if there is now a tool that frees you from the tedious work out of the above, can help you build the project, management jar package, compiled code, but also help you to automatically run the unit test, package, report generation, and even help you deploy the project to generate Web site, you heart it?

Well, that's not much, but in fact, Maven can solve the problems mentioned above.

Maven project did not jar package it is not fragrant Well, it still does not run Hong thing?

First of all, I prove it Maven project does not specifically jar package

Here Insert Picture Description
After I close the entire section and use a lot of the high number of analyzes and took half an hour, it concluded that there must be no jar package! Otherwise, how could it be so small, only 100 Kb, Paige can see it ~

Science maven need to know

Maven is a core feature is dependent on management , dependency management and a clear, that is to manage the process of jar package , since no specific project maven jar package, that's how you can run it? In fact, simply, a Maven project on the jar package mainly to see the pom.xmlfile, and then coordinate to the warehouse to find the corresponding jar package, professional terminology is not listening very awkward, ha ha

Coordinate = company name / organization name + name + version number of the project, looking for a jar package must determine the coordinates of the warehouse : warehouse divided into local and remote repository \ central repository local repository : specifically where their computer to download jar package central warehouse : Networking go online to find local PW jar package: the company's own warehouse (to know there is such a thing on the line)

Figure understanding may be more handy

Here Insert Picture Description
DETAILED jar maven find the coordinates of the packet flow is as follows:
Here Insert Picture Description

How to find the center of the warehouse and into the jar package coordinate local warehouse jar package?

Actually very simple, in the central warehouse in dictionary to know what to look for as long as the jar package, you can get what jar package, as follows: Specific to find spring aop jar package as an example:

Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
It is not very simple? get to the Well ~

maven life cycle and command

I think, and now I use maven for so long did not how to use its life cycle, so I think there is no need to write long-winded, to know you can (if you want to be proficient in maven, if you have the time and energy left to go looking information in this regard in-depth)

Here Insert Picture Description
Here, basically common things already finished, and I'm talking about are the focus, maven focus on small, is not very simple, of course, I am talking about is simple. In fact, a study is to simplify the process!

maven download installation

Download: Method One: maven official website: maven.apache.org/ Method two: direct Baidu maven (recommended! Do not ask me why, I would like Jiang Zi, simple and crude, not to engage in those bells and whistles)

Here Insert Picture Description
Here Insert Picture Description
As for installation, extract the equivalent installed, a decompression get away, I feel maven developers is a genius, is a countryman like me, like the simple and crude, not to engage in those bells and whistles!

Maven and the JDK configuration (understand)

As I write to understand why, because they are aware configuration, is not it annoying? I feel tired of Ge Jige, ye who are brothers, ah, I remember that afternoon with my special What the afternoon, only with a good (and I did not question the process, have popped a wonderful special issue, picked it sad, not to mention), and later I found a good distribution up to now have not used, no use . . . I suggest that if just simply do not engage in this project on the configuration of the bells and whistles, and now I did not really go with that configuration (complete some of the major commands), is unworthy, but one thing to remember: the JDK version 1.7 . If you are a non-persistent to learn how to configure, I'll tell you, in fact, now with java environment variables almost as well java_HOME similar operations ( can not be formulated, no problems ), but you can say that I am vulgar, but you definitely do not know "vulgar "Men also countryman medals, ah, know anything about feelings ~

Here Insert Picture Description

Configure the local warehouse location

Of course, this fact can not be formulated because the idea will default to put your C drive, but good people like me, - poor, small C disk space - will definitely go to configure the look slightly, the local warehouse on D F disk or disk (you do not willful, or configure it, in case your system the day the bombing na, jar package may no more duck) ~

Configuration process: First, open the folder maven extract the good ---- conf ---- setting.xml open plus the need to configure the following location:

Here Insert Picture Description

The first project to create a Mawen use IntelliJ IDEA

IDEA had not used to build several elder brother may know, I wrote this before using IntelliJ IDEA project to create the first Mawen

Ssm use Maven to build combat

I used the idea to build a framework through ssm based mawen, specifically used maven, Ge Jige can find out in this article how the clarity of ideas using IDEA ssm integration framework (detailed ideas + with source code)

Here, the basic operation of the blast on Peipei Pei mother, sister paper of the basic operation Keke is OK, even if it is the perfect entry-maven foundation, and I am talking about the core of conventional operations are maven's just to let beginners Quick Start of course this is not enough, because developers have to learn multi-module maven, in fact, very simple, first here today, and waved his claw ~

If this article there is a little bit of help to you, then please point a chant praise, thank you ~

Finally, if there is insufficient or is not correct, please correct me criticism, grateful! If you have questions please leave a message, the absolute first time to reply!

I welcome you to focus on the public number, to explore technology, yearning technology, the pursuit of technology, said good pots Friends is coming Oh ...

Here Insert Picture Description

Guess you like

Origin juejin.im/post/5ddbb65b6fb9a07a9d7b9c72