在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宿主机上的私有仓库