maven安装及本地私有仓库搭建

在win8.1操作系统上,通过虚拟机来访问搭建在win8.1上的nexus本地私有仓库
注:下文出现的192.168.26.1为Vmnet8虚拟网卡的地址

maven的安装

[1] Ubuntu环境下安装
   a.下载并解压apache-maven-3.3.9-bin.tar.gz到/soft目录下
   b.创建符号链接

   $>cd /soft
   $>ln -s apache-maven-3.3.9 maven

   c.配置maven环境变量
   [/etc/environment]

   M2_HOME=/soft/maven
     PATH=...:/soft/maven/bin

   d.生效环境变量 

     $>source /etc/environment

[2] Windows下安装

   a.下载并解压到D盘下
   b.配置maven环境变量

   M2_HOME=D:\apache-maven-3.3.9
     PATH=...:;%M2_HOME%\bin;

在Win8.1上搭建maven本地仓库服务器

1.安装tomcat
2.安装nexus.war文件 启动服务器之后会被自动解压。注意:nexus.war文件放在win7下
a.复制nexus.war到${tomcat_home}/webapps
b.启动tomcat
c.http://localhost:8080/nexus
3.在ubuntu中配置maven的settings.xml,连接到本地仓库服务器。
[/soft/maven/conf/setting.xml]
执行之前先做个备份

$>cp setting.xml setting.xml.bak
$>gedit setting.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<pluginGroups>
</pluginGroups>
<proxies>
</proxies>

<servers>
    <server>
        <id>releases</id>
        <username>admin</username>
        <password>admin123</password>
    </server>
    <server>
        <id>snapshots</id>
        <username>admin</username>
        <password>admin123</password>
    </server>
</servers>
<mirrors>
    <mirror>
        <id>nexus</id>
        <mirrorOf>*</mirrorOf>
        <url>http://192.168.26.1:8080/nexus/content/groups/public/</url>
    </mirror>
</mirrors>
<profiles>
    <profile>
        <id>nexus</id>
        <repositories>
            <repository>
                <id>central</id>
                <url>http://192.168.26.1:8080/nexus/content/repositories/central/</url>
                <releases>
                    <enabled>true</enabled>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
        </repository>
    </repositories>
<pluginRepositories>
    <pluginRepository>
        <id>central</id>
        <url>http://192.168.26.1:8080/nexus/content/repositories/central/</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
    <activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>

maven本地仓库服务器的配置

编辑D:\apache-tomcat-7.0.72\webapps\nexus\WEB-INF\classes\nexus.properties

nexus-work=D:/maven-repo/nexus      //私有仓库中相关文件的存放地址
runtime=${bundleBasedir}
nexus-app=${runtime}

至此,搭建本地私有仓库服务器完成。可以在虚拟机上访问win8.1宿主机上的私有仓库

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值