MAVEN Environment Build +eclipse plug-in installation + basic project configuration

Source: Internet
Author: User

today I learned about MAVEN environment building, and project deployment, summarized under. The company recently in the use of Maven+jekins automatic release, so there is the idea of learning, just to use the automatic test has been learning. 1. Software Download:
a.m. aven3.0.5 : http://www.xdowns.com/soft/38/121/2013/Soft_105445.html        of course, can also be downloaded to the official website: http://maven.apache.org/ --I can't keep it open . b.eclipse Download, Baidu on a lot here slightly C.JDK Installation Here, configure the environment variables .

2.maven environment variable configuration:        download good in 1Maven3.0.5, put inD:\Program files\maven3.0.5addresses are placed with personal interests. 2. 1 in My Computer-systemProperties-Advanced-Environment Variables-system environment variables-NEW:Variable Name:Maven_homeVariable Value:D:\Program Files\maven3.0.5,    
2. 2 Locate the path in the system environment variable and add the variable value:%maven_home%\bin, after completion OK save.


    very good, this time Maven has been installed, to test it, Check our java environment and maven is the environment wrong, Enter mvn-v on the cmd page,


3. Modify the warehouse location

At this point, the final step is configured:Warehouse location,Modify the warehouse address, which is used to store all the items that the project relies onJarpackage. Here I set the warehouse path to:D:\Maven\repositories, set the path with your personal preference: Open the installation path for Maven in 1: D:\Program files\maven3.1.1\confunder the directorySetting.xmlfile, find the following code to modify it:


(To a little episode, last week in the configuration to go to this step has been stuck, has not been solved, today only found that because of their carelessness in the last line of the configuration is not put to-and after the configuration path is not resolved, the warehouse code has been loaded into the default path of the C drive, resulting in eclipse has not been able to connect. )

Next, use the command to verify that the configuration is successful, enter in cmd: mvn help:system,


at this point, open the above created warehouse file(D:\Maven\repositories), you'll find a lot more files.. These files are ourmaventhe central repository is downloaded to the local repository. (can also be downloaded automatically in eclipse)

4. Add a warehouse Map

Because the default warehouse download jar package super slow, download from the foreign website, this speed you understand. So here set the mapping, I also searched on the internet a lot of addresses are tested under, and finally found a fastest mapping address. Nonsense not to say, paste it out: (Continue to find the mirror node in the setting file, join)

<mirror>

<id>cn</id>

<name>oschina central</name>                            ,         &NB Sp                          ,         &NB Sp                          ,         &NB Sp         

<url>http://maven.oschina.net/content/groups/ Public/</url>

<mirrorof>central</mirrorof>

</mirror>

Note: The MAVEN project was not running successfully at first because there was no configuration mapping, and the jar pack update would get stuck and it went well with this address.

5. The next step is to test if MAVEN is working properly.
Write the code: (Next Hellomaven.java is placed under the corresponding package)        5.1 Create the Pom.xml file under the project root directory, as follows:            
5.2 Enter the directory where the project is located, execute mvn compile,d:\javawork\autotest\maven-ch01> MVN Compile, MAVEN-CH01 is the current project and is displayed after successful compilation:            
OK, now you can find the compiled class file, under Maven-ch01\target\classes\main\java\com\test will generate Hellomaven.class file
            
------Happy, MAVEN environment finally usable, praise!!!
6. Install the Maven for Eclipse plugin, this step will be long6.1after you have downloaded Eclipse Open, go to menu: Help-Install new software, pop-up window in work withInput:http://download.eclipse.org/technology/m2e/releases Enter,                                       Now that the Maven plugin selection is displayed, the next step is to install and restart eclipse after installation.
6.2 The MAVEN repository path can then be configured, click Windows-Preferences,
            Click Add, select the local download of the Maven file, that is, 1 download the installation of maven3.0.5, note that after the successful addition, the path in the following global settings will be changed by default
The next step is to set up the setting file, and in user settings, select the Settings.xml file in the maven3.0.5 installation file
, at this point in the local repository will know the default selection to the warehouse file path, see Figure Bar:            

7.OK, all the configuration is over, go down to build a project, let eclipse automatically update the warehouse file bar, time is very slow, and so on ...

Well, let's take a picture and record this magical moment:

         



From for notes (Wiz)

Maven Environment Build +eclipse plug-in installation + basic project configuration

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.