ubuntu下安装maven

下载maven

解压
tar -xzvf apache-maven-3.0.5-bin.tar.gz

配置环境变量

sudo vim /etc/profile
添加
export M2_HOME=/home/weibo/apache-maven-3.0.5
export M2=$M2_HOME/bin
export PATH=$M2:$PATH
保存 
source profile

测试

mvn -version

OK 

公司的maven还需要配置settings.xml(maven包的conf里的settings.xml可不用管)
把附件中的文件放到存放类库的位置(一般是{user.dir}/.m2/里)
注意更改其中的<localRepository>的值

<?xml version="1.0"?>
<!-- ======================================================================== -->
<!--  settings.xml for maven users                                            -->
<!--  Version: 3                                                              -->
<!--  Auhtor: jingshun shi                                                    -->
<!--  $Id: settings.xml 220145 2012-11-23 01:41:14Z jingshun.shijs $ -->
<!-- ======================================================================== -->


<settings>
<!-- ======================================================================== -->
<!--  Accounts for SCM ONLY                                                   -->
<!-- ======================================================================== -->
<localRepository>D:\m2\repo</localRepository> 
<servers>
<server>
<id>releases</id>
<username>maven</username>
<password>secret</password>
</server>
<server>
<id>snapshots</id>
<username>maven</username>
<password>secret</password>
</server>
</servers>


<!-- ======================================================================== -->
<!--  Profiles                                                                -->
<!-- ======================================================================== -->
<profiles>
<profile>
<!-- ======================================================================== -->
<!--  Managed Repositories for Alibaba Dev,include tabao repos and center repo-->
<!-- ======================================================================== -->
<id>alibaba</id>
<repositories>
<repository>
<id>central</id>
<name>Alibaba Repositories Group</name>
<url>http://repo.alibaba-inc.com/nexus/content/groups/alirepositiry/</url>
</repository>
<repository>
                <id>pwatir</id>
              <url>http://maven.pwatir.com/artifactory/repo/</url>
            </repository>
</repositories>

<!-- ======================================================================== -->
<!--  Repositories for maven plugins          -->
<!-- ======================================================================== -->
<pluginRepositories>
<pluginRepository>
                                        <id>central</id>
                                        <name>Alibaba Plugin Repos Group</name>
                                        <url>http://repo.alibaba-inc.com/nexus/content/groups/alirepositiry/</url>
</pluginRepository>
</pluginRepositories>
</profile>


<profile>
            <id>android</id>
            <properties>
                <android.sdk.path>
                    D:\android_ide\sdk <!-- 此处为自己sdk路径 -->
                </android.sdk.path>
            </properties>
        </profile>

</profiles>


<pluginGroups>
<pluginGroup>com.alibaba.org.apache.maven.plugins</pluginGroup>
<pluginGroup>com.alibaba.maven.plugins</pluginGroup>
</pluginGroups>
<activeProfiles>
                <activeProfile>alibaba</activeProfile>
<activeProfile>android</activeProfile>
</activeProfiles>
</settings>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值