下载 nexus-2.12.0-01-bundle.zip
将文件解压,然后打开命令提示符,定位到解压目录下nexus-2.12.0-01下的bin目录。
执行nexus.bat install
出现上述提示表示安装成功
接着启动服务nexus.bat start
如果出现如下提示表示启动失败。此时需要修改文件。
在安装文件中找到wrapper.conf文件找到第15行将wrapper.java.command=你的java.exe
文件所在的位置
若出现下面提示表示启动成功
完成后要实现从本地向私服上传文件需要配置路径及登录的用户名密码
配置登录密码:
在maven的安装目录下找到settings.xml然后在service标签中添加如下标签
<server>
<id>releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
上面是登录私服默认的用户名与密码,
<profile>
<!--profile的id-->
<id>dev</id>
<repositories>
<repository>
<!--仓库id,repositories可以配置多个仓库,保证id不重复-->
<id>nexus</id>
<!--仓库地址,即nexus仓库组的地址-->
<url>http://192.168.119.129:8081/nexus/content/groups/public/</url>
<!--是否下载releases构件-->
<releases>
<enabled>true</enabled>
</releases>
<!--是否下载snapshots构件-->
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<!-- 插件仓库,maven的运行依赖插件,也需要从私服下载插件 -->
<pluginRepository>
<!-- 插件仓库的id不允许重复,如果重复后边配置会覆盖前边 -->
<id>public</id>
<name>Public Repositories</name>
<url>http://192.168.119.129:8081/nexus/content/groups/public/</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>dev</activeProfile>
</activeProfiles>
上面是下载位置相关配置192.168.119.129:8081应该换成自己搭建的服务器的ip及端口号。
将如下代码添加到自己的pom.xml中,其中的localhost:8081应该换成自己搭建的服务器的ip及端口号
<distributionManagement>
<repository>
<id>releases</id>
<url>http://localhost:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
在eclipse中出现下面信息就表示连接私服并下载依赖包成功。
相关问题:
ArtifactDescriptorException: Failed to read artifact descriptor for commons-beanutils:commons-beanutils:jar:1.9.1: ArtifactResolutionException: Failure to transfer commons-beanutils:commons-beanutils:pom:1.9.1 from http://192.168.52.134:8081/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced. Original error: Could not transfer artifact commons-beanutils:commons-beanutils:pom:1.9.1 from/to nexus (http://192.168.52.134:8081/nexus/content/groups/public/): No response received after 60000
翻译
ArtifactDescriptorException:无法读取commons-beanutils的artifact描述符:commons-beanutils:jar:1.9.1:ArtifactResolutionException:未能传输commons-beanutils:commons-beanutils:pom:1.9.1 from http://192.168.52.134:8081 / nexus / content / groups / public /被缓存在本地存储库中,在nexus的更新间隔过去或更新被强制之前,决议将不被重新尝试。 原始错误:无法传输工件commons-beanutils:commons-beanutils:pom:1.9.1 from / to nexus(http://192.168.52.134:8081/nexus/content/groups/public/):60000后没有收到回复
解决办法
2.到本地Maven仓库找到对应位置(就是这个jar包的位置),这时候可能会发现里面有*.lastupdate一些文件,删除之后重新下载。(网络不好可能要重复多次)
将所有提示出来的jar包中的*.lastupdate全部删除掉再次更新即可