maven is a software project management tool that manages project building, reporting, and documentation, based on the Project object model (project item, POM), through a small description of the information.
For now, the vast majority of developers have used Ant as a standard building tool for Java programming projects. However, Ant's project management tools (as an alternative to make) do not meet the needs of most developers. By examining the Ant build file, it is difficult to find dependency information and other meta-information (such as developer/owner, version, or site home page) of the project.
In addition to its program building capabilities, Maven offers advanced project management tools that are missing from Ant. Because MAVEN's default build rules are highly reusable, it is often possible to build a simple project with two or three rows of maven building scripts, while using ANT requires more than 10 rows. In fact, because of MAVEN's project-oriented approach, many Apache Jakarta projects now use MAVEN, and the proportion of company projects using MAVEN continues to grow.
The word maven comes from Yiddish, meaning the accumulation of knowledge, which was first used in the Jakata turbine project to try to simplify the construction process. There were many projects at the time, their ant build files were only slightly different, and the jar files were maintained by CVS. So the Maven founders started MAVEN, a clear definition of the project, including a convenient way to publish project information, and a way to share jars across multiple projects.
What's the difference between Maven and Ant?
ANT provides cross-platform build tasks for Java technology development projects
Maven itself describes the advanced aspects of the project, which borrows most of the build tasks from Ant
We need to install the JDK first.
Official website: http://maven.apache.org/index.html
Installation process:
[Email protected] ~]# cd/usr/local/src/
[[Email protected] apache-maven]# tar zxf apache-maven-3.0.5-bin.tar.gz-c/usr/local/[[email protected] apache-maven]# Mv/usr/local/apache-maven-3.0.5/usr/local/apache-maven
To configure environment variables:
Echo-e ' #!/bin/bash\nexport maven_home=/usr/local/apache-maven\nexport path= $PATH: $MAVEN _home/bin ' >/etc/ Profile.d/maven.sh[[email protected] apache-maven]# source/etc/profile.d/maven.sh
Verify:
[Email protected] apache-maven]# mvn-v
The following prompt appears to indicate successful installation
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 21:51:28+0800)
Maven Home:/usr/local/apache-maven
Java version:1.8.0_60, Vendor:oracle Corporation
Java Home:/usr/local/src/jdk1.8.0_60/jre
Default Locale:en_us, Platform Encoding:utf-8
OS name: "Linux", Version: "2.6.32-431.el6.x86_64", Arch: "AMD64", Family: "Unix"
Maven configuration file:
Setting.xml configuration files, which are available in the installation directory (/usr/local/apache-maven/conf/settings.xml) and local directory (/home/homer/.m2/settings.xml), differ:
1) installation directory (conf/settings.xml), is valid for all users on this machine (the same machine can have multiple users, both valid), global settings
2) current directory (. m2/settings.xml), valid only for the current user, local settings
MAVEN also has a configuration file Pom.xml, which is in the root directory of the Java project and is only valid for the current project, local settings
More about MAVEN's use:
Http://www.oracle.com/technetwork/cn/community/java/apache-maven-getting-started-1-406235-zhs.html
> The front is a brief introduction maven and maven the central repository provided by default is the remote Network service appache provided, which is unreasonable for us to develop. What do we do if we're out of the net or what? That means the central warehouse of our team is too dependent. and nexus can solve our problem. First look at this picture should be a non-only understand:
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/84/43/wKioL1eKgpGQqVZZAAFZPGyw8hQ876.png-wh_500x0-wm_3 -wmp_4-s_1299708308.png "title=" 20140914194713345.png "width=" "height=" 493 "border=" 0 "hspace=" 0 "vspace=" 0 " Style= "WIDTH:700PX;HEIGHT:493PX;" alt= "Wkiol1ekgpgqqvzzaafzpgyw8hq876.png-wh_50"/>
This is equivalent to building a central warehouse in our local LAN server, we began to download some of the central warehouse information on the private server, and then we usually maven The project is to directly access the local area network, can not only save network bandwidth will also accelerate the process of project construction, so for our development, for the company is a very good choice.
We need to install the JDK first.
Build Nexus:
: http://www.sonatype.org/nexus/archived_version?id=38
[Email protected] src]# wget [[email protected] src]# tar-zxf nexus-2.9.0-bundle.tar.gz-c/usr/local/[[email protected ] src]# Mv/usr/local/nexus-2.9.0-bundle/usr/local/nexus
Configure the Nexus (Configure the port number of the Nexus listener as needed):
Sed-i ' s/application-port=8081/application-port=8088/g ' nexus/conf/nexus.properties
Start Method One,
The configuration environment variable (run_as_user=root) indicates that the Nexus is run with root:
[Email protected] ~]# echo-e ' #!/bin/bash\nexport nexus_home=/usr/local/nexus\nexport path= $PATH: $NEXUS _home/bin\ Nexport run_as_user=root ' >/etc/profile.d/nexus.sh[[email protected] ~]# Source/etc/profile.d/nexus.sh[[email Protected] local]#/usr/local/nexus/bin/nexus start[[email protected] local]# NETSTAT-TLUNP |grep 8088
TCP 0 0 0.0.0.0:8088 0.0.0.0:* LISTEN 2671/java
Start method Two (service),
Step1 (copy startup script)
[[email protected] local]# Cd/usr/local/nexus/[[email protected] nexus]# CP bin/nexus/etc/init.d/
Step2 (Modify script)
Vim/etc/init.d/nexus
Added two rows of parameters
# chkconfig:2345 39# description:running&stop Nexus Service.
Modify two rows of parameters
Nexus_home= "/usr/local/nexus" Run_as_user=root
Step3 (Increase execution privileges)
[Email protected] nexus]# chmod +x/etc/init.d/nexus
Step4 (handed to Chkconfig management)
[Email protected] nexus]# Chkconfig--add Nexus
STEP5 (Start)
[[Email protected] nexus]# service Nexus start
Access Nexus:
http://192.168.31.123:8088/nexus/
This article is from the "beginner's mind, always" blog, please be sure to keep this source http://gouyc.blog.51cto.com/1594451/1827069
Maven+nexus Building a local database