maven window7环境配配置

来源:互联网 发布:linux是什么 编辑:程序博客网 时间:2024/05/02 18:19

下载地址:https://maven.apache.org/download.cgi

直接下载:http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz


1.解压安装

我这里直接安装到E:\apache-maven-3.3.9


2.配置存储库

编译E:\apache-maven-3.3.9\conf  路径下的settings.xml

查找localRepository节点,追加下面内容,然后保存。

修正前:

    <!-- localRepository         | The path to the local repository maven will use to store artifacts.         |         | Default: ${user.home}/.m2/repository        <localRepository>/Soft/repository</localRepository>        -->  

修正后:

<!-- localRepository     | The path to the local repository maven will use to store artifacts.     |     | Default: ${user.home}/.m2/repository    <localRepository>/Soft/repository</localRepository>    -->  <localRepository>/Soft/repository</localRepository> 

(2).配置镜像库

因为国内的网络访问Maven存储库会很慢,所以这里我采用了阿里的镜像存储。同样编辑conf/settings.xml文件。查找mirrors节点,修改追加下面内容,然后保存并退出。

修正前:

  <mirrors>    <!-- mirror     | Specifies a repository mirror site to use instead of a given repository. The repository that     | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used     | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.     |    <mirror>      <id>mirrorId</id>      <mirrorOf>repositoryId</mirrorOf>      <name>Human Readable Name for this Mirror.</name>      <url>http://my.repository.com/repo/path</url>    </mirror>     -->  </mirrors>

修正后:
  <mirrors>    <!-- mirror     | Specifies a repository mirror site to use instead of a given repository. The repository that     | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used     | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.     |    <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>alimaven</id>        <name>aliyun maven</name>        <url>http://maven.aliyun.com/nexus/content/groups/public/</url>        <mirrorOf>central</mirrorOf>              </mirror>  </mirrors>
配置完以上配置后:

打开我的计算机(右键)——>更改配置——>高级——>环境变量


在系统变量:新建

变量名:M2_HOME

变量值:(maven解压位置,我这里是)E:\apache-maven-3.3.9


找到 path 编辑

在变量值那里的最后边输入;%M2_HOME%/bin

保存!

打开cmd控制台

输入mvn -version

得到:

<span style="font-size:18px;"><span style="background-color: rgb(0, 0, 0);"><span style="color:#FFFFFF;">C:\Users\Administrator>mvn -versionApache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)Maven home: E:\apache-maven-3.3.9Java version: 1.8.0_11, vendor: Oracle CorporationJava home: E:\JAVAjdk\jreDefault locale: zh_CN, platform encoding: GBKOS name: "windows 7", version: "6.1", arch: "x86", family: "dos"C:\Users\Administrator></span></span></span>



本文参考:http://blog.csdn.net/stemq/article/details/52911917

0 0
原创粉丝点击