用Nexus来搭建本地的Maven服务器
下载地址是:http://nexus.sonatype.org/downloads/
我下载的是:nexus-oss-webapp-1.8.0.1-bundle.tar.gz
一、安装服务器
解压下载的文件:
# tar xzvf nexus-oss-webapp-1.8.0.1-bundle.tar.gz
解压后目录:
nexus-oss-webapp-1.8.0.1 包含了nexus的运行环境和应用程序
sonatype-work 包含了你自己的配置和数据
启动nexus
进入nexus-oss-webapp-1.8.1目录
# cd nexus-oss-webapp-1.8.0.1/bin/jsw
根据自己机器选择版本
我选择的是 linux-x86-32
# cd linux-x86-32/
linux-x86-32目录结构
:lib nexus nexus.pid platform.conf wrapper
nexus就是启动命令
# ./nexus
执行上面的命令,可以得到nexus命令的用法提示:start 命令启动,stop命令停止。下面启动nexus:
# ./nexus start
以上表示启动成功!
通过log文件查看更详细的信息
# cd ~/nexus-oss-webapp-1.8.0.1/log
# tail -f wrapper.log
在log中可以看到nexus默认监听的端口是8081。那么我们就可以在浏览器中访问:http://host:8081/nexus
默认用户名是admin密码是admin123
二、配置Nexus
由于在新搭建的nexus环境中只是一个空的仓库,所以第一步就是要和远程的Maven中心仓库进行同步。
如果在Reindex之后,并没有同步到远程的仓库,可以检查每个仓库的设置。下面是Maven Central的设置:
三、在项目中使用私服
在完成了上面的配置后,就可以将项目中默认的Repository切换为本地的私服了,只需要在pom.xml中增加repositories就可以了:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycom.test</groupId>
<artifactId>simple</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>simple</name>
<url>http://maven.apache.org</url>
<repositories>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>public</id>
<name>Public Repositories</name>
<url>http://192.168.1.7:8081/nexus/content/groups/public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>public</id>
<name>Public Repositories</name>
<url>http://192.168.1.7:8081/nexus/content/groups/public//</url>
</pluginRepository>
</pluginRepositories>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
将pom.xml保存后,再回过头来了看去nexus管理界面看,就会发现junit已经被下载到本地的nexus服务器中了。
- 大小: 8.7 KB
- 大小: 8.5 KB
- 大小: 43.1 KB
- 大小: 85.6 KB
- 大小: 50.8 KB
- 大小: 62 KB
分享到:
相关推荐
Windows 下Nexus搭建Maven私服 Windows 下Nexus搭建Maven私服
Nexus搭建Maven私服 +maven安装步骤
关于使用Nexus搭建Maven私服的开发文档。新手了解一下。
使用Nexus1.8搭建MAVEN私服详细步骤,以及在网页上上传JAR包
在CentOS7上用Nexus3搭建Maven私服。 一、需要的环境 CentOS 7里需要安装jdk8和Maven3,具体的安装步骤可以百度一下。 二、需要的包 需要nexus3的安装包,官网上https://www.sonatype.com/download-oss-sonatype...
提供了基于Nexus搭建Maven私服所需要的一切资源和个人经验,搭建后可maven deploy 上传自己的jar包。别人如何在自己的maven项目中引用我将单独再上传一份。
搭建maven私服的软件,包括maven版本3.5.3,nexus版本3.12.1
maven使用及Nexus搭建Maven私服
详细的使用Nexus搭建Maven私服的步骤指导
搭建Maven私服,并配置Nexus环境.rar
linux下搭建内网maven私服
操作步骤清晰 简单易懂,分分钟就完成搭建
使用nexus 可以搭建maven私服,如何使用nexus搭建maven 本地服务器呢?
nexus搭建maven私服1
nexus3搭建maven 私服资源
Maven Nexus 私服搭建 从零开始,资源下载、安装指导、开发配置说明
linux,搭建maven私服,nexus3.14+maven3.6.3.zip,apache-maven-3.6.3-bin.tar.gz,nexus-3.14.0-04-unix.tar.gz
nexus1.9_搭建maven私服,搭建项目管理方便开发