个人工具

Nexus

来自Ubuntu中文

Oneleaf讨论 | 贡献2016年4月22日 (五) 18:02的版本 使用

(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航, 搜索

搭建一个私有的maven仓库,同时支持缓存和代理。

说明

下载地址:

 http://www.sonatype.com/download-oss-sonatype

选择

nexus-3.0.0-03-unix.tar.gz

下载

安装

安装 openjdk1.8

apt-get install software-properties-common
add-apt-repository ppa:openjdk-r/ppa
apt-get update
apt-get install openjdk-8-jdk
update-alternatives --config java
update-alternatives --config javac

安装 nexus

tar xzvf nexus-3.0.0-03-unix.tar.gz
mv nexus-3.0.0-03 /usr/local/nexus
ln -s /usr/local/nexus/bin/nexus /etc/init.d/nexus
update-rc.d nexus defaults
/etc/init.d/nexus start

打开 nexus

访问 http://x.x.x.x:8081/

默认用户名 : admin 密码:admin123

使用

修改 ~/.m2/settings.xml

注意下面的localhost地址修改为你服务器的实际地址。

<settings>
 <mirrors>
   <mirror>
     <id>nexus</id>
     <mirrorOf>*</mirrorOf>
     <url>http://localhost:8081/repository/maven-public/</url>
   </mirror>
 </mirrors>
 <profiles>
   <profile>
     <id>nexus</id>
     <repositories>
       <repository>
         <id>central</id>
         <url>http://central</url>
         <releases><enabled>true</enabled></releases>
         <snapshots><enabled>true</enabled></snapshots>
       </repository>
     </repositories>
    <pluginRepositories>
       <pluginRepository>
         <id>central</id>
         <url>http://central</url>
         <releases><enabled>true</enabled></releases>
         <snapshots><enabled>true</enabled></snapshots>
       </pluginRepository>
     </pluginRepositories>
   </profile>
 </profiles>
 <activeProfiles>
   <activeProfile>nexus</activeProfile>
 </activeProfiles>
</settings>