maven has recently been used in new projects, so a lot of the information on the web is getting bogged down in all sorts of complexities. I always feel that learning a new technology, first of all know why learn? Next is the fastest speed entry (you can run a simple demo). other in the work met at Google is good. Can not learn a lot of, and finally found no use, time long and forget.
question: Why learn Maven?
solved: Team development, need to load various packages, synchronization problems between members.
Maven is a project management and building automation tool. Maven uses the configuration file to manage the packages and versions that the project relies on, separating the project from dependencies.
All package dependencies are abstracted into the name of a package plus a package version , and these two items will be uniquely positioned to a package, and the corresponding package cannot be modified in principle. So what if the package is updated ? then increase the version number and create a new connection. In this way, we have avoided the various nonstandard problems in the project package management to some extent , so that we can make the project dependent management very convenient.
How to install? Baidu Google must know.
Here's a brief talk about Maven's basics:
The standard Maven directory :
Src
-main
-java
-resources
-filters
-assembly
-config
-test
-java
-resource
-filters
-site
Target
-classes
-test classes
-site
For an example of how to configure the environment for a spring WEB MVC project, describe the initial use of Maven in detail:
(1) Eclipse--and file---
This step in the middle note this option:
Note the input here, the specific explanation will be followed by:
(2) Find the dependency of sping Web MVC (don't understand?) Explained later)
1,maven Central Warehouse (in foreign countries, there are also mirrors, the latter will be described in maven second) to find a specific dependency address
2, add to Pom.xml ask the file
Maven Central Warehouse Home page:
Note the data in the red box and paste it in the relevant location in the Pom file:
Right-click the project file and click Update!
Finally, it worked!
Here are some additional notes on the above knowledge points:
Look at these four lines first:
< groupId >com.hanchun.maven</groupId>
< Artifactid > meven-demo</artifactid>
< Packaging >War</packaging>
< version > 0.0.1-snapshot</ Version >
Here is the project name and version of this project I have since , and when we pack it, the project name and version will also be our jar + version, published to maven server.
< Dependencies >
< Dependency >
< groupId > JUnit </ groupId >
< Artifactid > JUnit </ Artifactid >
< version >4.4</version>
< Scope >Test</scope>
</ Dependency >
< Dependency >
< groupId >org.springframework</groupId>
< Artifactid >spring-webmvc</artifactid>
< version >4.2.0.RELEASE</version>
</ Dependency >
</ Dependencies >
these lines, so that we add the dependency, maven from the center of his own Service Device inside, according to junit.junit:4.4 and the
Org.springframework. spring-Webmvc. 4.2.0.RELEASE go find him. The corresponding dependent jar package is downloaded and introduced as a dependency package for the project.
< Build >
< Finalname > meven-demo</finalname>
< sourcedirectory > src/main/java</sourcedirectory>
</ Build >
what the project will do during the packing period. It will Pack The files under Src/main/java into Maven-demo.jar .
Did you see it? Welcome to discuss Http://blog.csdn.net/code_7
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Maven Simple Tutorial (i)