Configure MAVEN environment variables under Mac computer

Source: Internet
Author: User
Tags readable touch command

Configure MAVEN environment variables under Mac computer

      1. Open a terminal and use the Touch command to create a. bash_profile file

        .bash_profile

  1. Edit the file you just created. Bash_profile

    .bash_profileInput:
  2. M2_HOME=/Users/lizhimin/Documents/maven/apache-maven-3.3.3PATH=$M2_HOME/bin:$PATHexport M2_HOMEexport PATH(Note: Self-modifying according to your MAVEN version and path)
  3. Save exit, use

    source .bash_profile
  4. (Make the modified environment variable effective//or completely exit the terminal before you come in.)

  5. Verification, terminal input:

    -v
  6. Show:

    Apache Maven3.2.3 (33F8C3E1027C3DDDE99D3CDEBAD2656A31E8FDF4;2014- 08-12t04: 58: 10+08:00) Maven home:/Users/ Lizhimin/documents/maven/apache-maven-3.2.3Java version: 1.7.0_75, vendor:oracle Corporationjava Home:/library/java/javavirtualmachines/jdk1.7 .0_75.jdk/contents/home/jredefault locale:zh_cn, platform Encoding:utf-8os Name:  "Mac OS X",  Version:  "10.10.3", Arch: " Mac "             

    • Other

      If the input mvn-v displays the following:

      Error: JAVA_HOME is not defined correctly.  We cannot execute /usr/libexec/java_home/bin/java
    • You need to modify the. bash_profile file that we created

      Add to:

      export JAVA_HOME=$(/usr/libexec/java_home)
    • Then verify, OK.

2015-7-21 New

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Homeexport CLASS_PATH=$JAVA_HOME/libPATH=$PATH:$JAVA_HOME/binMAVEN_HOME=/Users/lizm/Documents/maven/apache-maven-3.3.3PATH=$MAVEN_HOME/bin:$PATHexport MAVEN_HOMEexport PATH

Scenario: Today's project development process, need to modify MAVEN update address, connect the company's Maven library, and then need to change the Setting.xml file in Maven package, encountered problems, before MAVEN configuration good, always use good, suddenly today terminal input mvn-v When there is a problem like this, the final fix. (I hope you're OK too)

Add:

Modify MAVEN's update path (one step, very simple):

Open apache-maven-3.3.3 > Conf > Settings.xml

Find the label modified to:

<Mirrors><!--Mirror | Specifies a repository mirror site to use instead of a given repository. The Repository that | This mirror serves have an ID, that matches, the mirrorof element of this mirror. IDs is used |     For inheritance and direct lookup purposes, and must is unique across the set of mirrors.    | <mirror> <id>mirrorId</id> <mirrorOf>repositoryId</mirrorOf> <name>huma N Readable Name for this mirror.</name> <url>http://my.repository.com/repo/path</url> </mirro R>--<Mirror><Id>mirrorid</Id><Mirrorof>repositoryid</Mirrorof><Name>human readable Name for this Mirror.</Name><Url>http://my.repository.com/repo/path</Url></mirror> <mirror> <id>awifi-public</ id> <mirrorof>central</mirrorof> <name>awifi public for this Mirror. </name> < url>http://192.168.10.129:8081/nexus/content/groups/public </url> </mirror> </MIRRORS>         

(Path to write your own company's path is good)

At this point, everything ok! Mr.--–@l

Configure MAVEN environment variables under Mac computer

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.