MAVEN build Environment (linux& Windows)

Source: Internet
Author: User

Install Maven1 under Linux. Prerequisites:

1) Download and install the JDK. Enter the command "Java-version" in the terminal, if a similar message appears stating that the JDK installation was successful.

$ java-version

Java Version "1.7.0_45"
OpenJDK Runtime Environment (rhel-2.4.3.3.el6-x86_64 u45-b15)
OpenJDK 64-bit Server VM (build 24.45-b08, Mixed mode)

2) Download eclipse. It is recommended to download the latest Java development version (my is Luna). This automates the integration of MAVEN plugins.

2. Start configuring MAVEN:

1) Download maven 3.2.3:http://maven.apache.org/download.cgi

2) Decompression apache-maven-3.2.3-bin.tar.gz, assuming that the decompression path is:/sandbox/my_maven/apache-maven-3.2.3.

3) Set Environment variables:

[Plain]View Plaincopy
    1. Set Maven_home System Variables
    2. $ export M2_home= "/sandbox/my_maven/apache-maven-3.2.3"
    3. Adding Maven_home\bin to an environment variable
    4. $ export path= $PATH: $M 2_home/bin
    5. Verify that you save
    6. $ echo $M 2_home
    7. Verify that the environment variable is set successfully
    8. $ mvn-v
    9. If a series of information appears stating that the environment variable is set successfully

Note: Since we are using export, the configured environment variables only work under the current shell, so do not close the current terminal in the middle, or you need to reconfigure.

If you want to configure a permanent environment variable, you can modify the /etc/profile or the. Bash_profile in the user directory. The previous one worked for all users, and the latter only worked for the user himself.

3. Create a MAVEN repository:

1) Create a folder, assuming the path is:/sandbox/my_maven/maven_repository.

2) Open the/sandbox/my_maven/apache-maven-3.2.3/conf/setting.xml file and set up our warehouse path:

[Java]View Plaincopy
    1. <!--localrepository
    2. | The path to the local repository maven would use to store artifacts.
    3. |
    4. | Default: ${user.home}/.m2/repository
    5. <localRepository>/path/to/local/repo</localRepository>
    6. -
    7. <localRepository>/sandbox/my_maven/maven_repository</localRepository>

3) Run commands in terminal to download files from the MAVEN central repository to Local:

$ mvn Help:system

4) without errors, open/sandbox/my_maven/maven_repository will find a lot more files.

Install Maven1 under Windows. Prerequisites:

1) Download eclipse. It is recommended to download the latest version of the Java development version (my is Luna). This automates the integration of MAVEN plugins.

2) Download and install the JDK.

3) Create a new system variable Java_home for the JDK installation path.

4) Add "%java_home%\bin" to "Path", which is the environment variable.

5) in the cmd input command "java-version", if a similar message appears stating that the JDK installation was successful.

2. Start configuring MAVEN:

1) Download maven 3.2.3:http://maven.apache.org/download.cgi

2) Unzip the apache-maven-3.2.3-bin.tar.gz, assuming the decompression path is: E:\eclipse\personal_file\apache-maven-3.2.3

3) Refer to the above method to set the system variable Maven_home to "E:\eclipse\personal_file\apache-maven-3.2.3" and add%maven _home%\bin to the environment variable.

4) Open cmd, enter "Mvn-v", the following words appear to indicate the success of the configuration.

3. Create a MAVEN repository:

1) Open the/sandbox/my_maven/apache-maven-3.2.3/conf/setting.xml file, you can see that the original Localrepository is commented out, resulting in the default Maven library for the home directory:

[Java]View Plaincopy
    1. <!--localrepository
    2. | The path to the local repository maven would use to store artifacts.
    3. |
    4. | Default: ${user.home}/.m2/repository
    5. <localRepository>/path/to/local/repo</localRepository>
    6. -

I personally do not like people to put the file, so will definitely set up a place where it should be to give it, if you need to change this directory in the Setting.xml file add a word on the good:

<localRepository>E:\eclipse\personal_file\.m2\repository</localRepository>

The middle part is the new MAVEN library address. The premise, of course, is that this address exists.

3) Open Eclipse,window->preferences->maven->user Settings, in the input box "User Settings" Select the settings.xml file changed above. Then click "Update Settings", you can see the following "Local Repository" Automatically update the path to Settings settings. By clicking the Apply button below, eclipse will automatically update the MAVEN library.

4) Since then, the MAVEN warehouse has been built. Open the warehouse path (here is E:\eclipse\personal_file\.m2\repository), you can find a lot more things.

4. Change the MAVEN installation configuration for Eclipse.

Open Window---preferences->maven->installations->add, add our own Maven address (for example, my is E:\eclipse\personal_file\ apache-maven-3.2.3) to "Installation home:". Select the installation after finish.

MAVEN build Environment (linux& Windows)

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.