]一、环境1、操作系统:Windows 10 Windows7 2、nexus版本:nexus-3.2.1-01-win64二、安装1、(群里已有下载好的,文件名是nexus-3.2.0-01-w
]
一、环境1、操作系统:Windows 10 Windows7 2、nexus版本:nexus-3.2.1-01-win64二、安装1、(群里已有下载好的,文件名是nexus-3.2.0-01-win64.zip)下载地址:http://www.sonatype.com/download-oss-sonatype
2、解压使用即可,解压完成后默认开放8081端口(一般情况下8081是已经被占用的,需要改端口,我改为了8084 以下有详细步骤)。3 配置文件修改①打开bin/nexus.vmoptions文件,配置一下-Dkaraf.data和-Djava.io.tmpdir这两个参数
②修改端口号三、使用3.1启动 在如下目录下,打开命令窗口,输入 nexus.exe/run 需执行一分钟启动完成
3.2 打开 按照如上修改的端口号启动成功后,在本地浏览器输入localhost:8084(端口根据实际情况)出现如下界面
3.3 登录 安装成功后有两个默认账号admin、anonymous,其中admin具有全部权限默认密码admin123;anonymous作为匿名用户,只具有查看权限。点击右上角 sign按钮 账号 admin 密码 admin123,登录成功
解释说明--pepositories说明maven-central:maven中央库,默认从https://repo1.maven.org/maven2/拉取jar maven-releases:私库发行版jar maven-snapshots:私库快照(调试版本)jar maven-public:仓库分组,把上面三个仓库组合在一起对外提供服务,在本地maven基础配置settings.xml中使用。
3.4 配置私服maven settings.xml文件
在settings.xml文件中增加如下代码(端口号根据实际情况)这里是修改的本地 用户端的maven
<servers> <server> <id>tomcat6</id> <username>admin</username> <password>admin</password> </server> <server> <id>nexus</id> <username>admin</username> <password>admin123</password> </server> </servers> <mirrors> <mirror> <id>nexus</id> <mirrorOf>*</mirrorOf> <url>http://私服的IP:8084/repository/maven-public/</url> </mirror> <mirror> <id>repo2</id> <mirrorOf>central</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://repo2.maven.org/maven2/</url> </mirror> </mirrors> <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> <profile> <id>nexus</id> <repositories> <repository> <id>nexus</id> <url>http://nexus-releases</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>nexus</id> <url>http://nexus-releases</url> <releases>true</releases>这里输入代码> <!-- 下面代表的是 工程使用本地私服jar包(注意端口号根据实际情况)--> <repositories> <repository> <id>apache-snapshots</id> <url>http://私服的IP:8084/nexus/content/repositories/apache-snapshots/</url> </repository> <repository> <id>Maven Central</id> <url>http://私服的IP:8084/nexus/content/repositories/central/</url> </repository> <repository> <id>releases</id> <url>http://私服的IP:8084/nexus/content/repositories/releases/</url> </repository> <repository> <id>snapshot</id> <url>http://私服的IP:8084/nexus/content/repositories/snapshots/</url> <snapshots> <enabled>true</enabled> </snapshots> </repository> <repository> <id>thirdparty</id> <url>http://私服的IP:8084/nexus/content/repositories/thirdparty/</url> </repository> </repositories> <!-- 下面代表的是 工程上传本地jar包到私服(注意端口号根据实际情况)--><distributionManagement> <repository> <id>nexus</id> <name>Releases</name> <url>http://私服的IP:8084/repository/maven-releases</url> </repository> <snapshotRepository> <id>nexus</id> <name>Snapshot</name> <url>http://私服的IP:8084/repository/maven-snapshots</url></snapshotRepository></distributionManagement> <id>nexus</id> <name>Snapshot</name> <url>http://私服的IP:8084/repository/maven-snapshots</url></snapshotRepository></distributionManagement>
编译到Maven私库 在工程中项目右单击->Run As->Maven build.. 进入如下界面 编译后在nexus中看到如下图结果,快照已经编译到nexus中Components-> maven-snapshots。