下载安装

下载地址

改动默认端口:

home\conf\nexus.properties

# Sonatype Nexus
# ==============
# This is the most basic configuration of Nexus. # Jetty section
application-port=9080
application-host=0.0.0.0
nexus-webapp=${bundleBasedir}/nexus
nexus-webapp-context-path=/nexus # Nexus section
nexus-work=${bundleBasedir}/../sonatype-work/nexus
runtime=${bundleBasedir}/nexus/WEB-INF

安装与启动

home\bin\nexus.bat

watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvd29iZW5kaWFua3Vu/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="" />

登录

http://localhost:9080/nexus

用户名、密码:admin/admin123

watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvd29iZW5kaWFua3Vu/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="" />

仓库说明

watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvd29iZW5kaWFua3Vu/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="" />

索引:

有些远程仓库拥有索引。下载其索引后,即使没有缓存远程仓库的jar包,我们也能够在本地搜索jar包的信息

手动更新索引

下载索引包

停止服务

删除 nexus-2.0.3-bundle\sonatype-work\nexus\indexer\central-ctx 下的索引

将下载索引包的全部内容拷贝到 nexus-2.0.3-bundle\sonatype-work\nexus\indexer\central-ctx ,重新启动服务且又一次登陆

watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvd29iZW5kaWFua3Vu/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="" />

查看索引

搜索服务

设置镜像

  <mirrors>
<mirror>
<id>mirrorId</id>
<mirrorOf>*</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://localhost:9080/nexus/content/groups/public/</url>
</mirror>
</mirrors>

当设置 mirrorOf 为 "*" 时,pom.xml中仓库是能够不用配置了

项目中增加新的依赖,将从私服中下载

		<dependency>
<groupId>com.demo.test</groupId>
<artifactId>test-b</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>

项目部署及远程仓库认证

pom.xml

<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.demo.test</groupId>
<artifactId>test-c</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging> <name>test-c</name>
<url>http://maven.apache.org</url> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> <dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency> <dependency>
<groupId>com.demo.test</groupId>
<artifactId>test-a</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency> <dependency>
<groupId>com.demo.test</groupId>
<artifactId>test-d</artifactId>
<version>0.0.1-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.demo.test</groupId>
<artifactId>test-b</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency> <dependency>
<groupId>abbot</groupId>
<artifactId>abbot</artifactId>
<version>0.12.3</version>
</dependency>
</dependencies> <!-- 部署 -->
<distributionManagement>
<!-- 公布版布置仓库 -->
<repository>
<id>test-c release</id>
<name>Test-c Release</name>
<url>http://localhost:9080/nexus/content/repositories/releases/</url>
</repository>
<!-- 快照版布置仓库 -->
<snapshotRepository>
<id>test-c snapshot</id>
<name>Test-c Snapshot</name>
<url>http://localhost:9080/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement> </project>

部署配置

	<!-- 部署 -->
<distributionManagement>
<!-- 公布版布置仓库 -->
<repository>
<id>test-c release</id>
<name>Test-c Release</name>
<url>http://localhost:9080/nexus/content/repositories/releases/</url>
</repository>
<!-- 快照版布置仓库 -->
<snapshotRepository>
<id>test-c snapshot</id>
<name>Test-c Snapshot</name>
<url>http://localhost:9080/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>

仓库认证

settings.xml

	<servers>
<server>
<id>test-c release</id>
<username>deployment</username>
<password>deployment123</password>
</server>
<server>
<id>test-c snapshot</id>
<username>deployment</username>
<password>deployment123</password>
</server>
</servers>

执行命令

mvn clean deploy

登录私服查看结果

快照版本号:

watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvd29iZW5kaWFua3Vu/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="" />

项目构建之maven篇:5.仓库及nexus创建私服-2的更多相关文章

  1. 项目构建之maven篇:2.HelloWorld项目构建过程

    文件结构说明: 项目构建生命周期: 清理 编译 測试 打包 执行 部署 清理与编译 hello\pom.xml POM:Project Object Model,项目对象模型 pom.xml与ant的 ...

  2. 项目构建之maven篇:6.生命周期与插件

    项目生命周期 清理 初始化 编译 測试 打包 部署 三套生命周期 1.clean pre-clean 运行一些须要在clean之前完毕的工作 clean 移除全部上一次构建生成的文件 post-cle ...

  3. 项目构建之maven篇:1.环境搭建

    maven下载: 下载地址 环境变量设置 watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvd29iZW5kaWFua3Vu/font/5a6L5L2T/fon ...

  4. 项目构建之maven篇:3.m2eclipse使用

    m2eclipse的安装 略 设置maven文件夹 设置用户个性化的maven配置 导入mavenproject 源码下载 watermark/2/text/aHR0cDovL2Jsb2cuY3Nkb ...

  5. Java项目工程化之项目构建工具Maven

    欢迎查看Java开发之上帝之眼系列教程,如果您正在为Java后端庞大的体系所困扰,如果您正在为各种繁出不穷的技术和各种框架所迷茫,那么本系列文章将带您窥探Java庞大的体系.本系列教程希望您能站在上帝 ...

  6. 07 Maven 使用Nexus创建私服

    7. Maven 使用Nexus创建私服 私服不是 Maven 的核心概念,它仅仅是一种衍生出来的特殊的 Maven 仓库.通过建立自己的私服,就可以降低中央仓库负荷.节省外网带宽.加速 Maven ...

  7. 项目构建工具maven的使用方法

    最近在开发javaweb项目中有用到maven,以前并不是很了解,于是学习了一些相关内容,记之共享. 本篇内容在Windows环境下实施,JDK版本使用的1.7.0_79. 一.maven是什么? 简 ...

  8. 走进JavaWeb技术世界12:从手动编译打包到项目构建工具Maven

    小李的Build之路(上) 转自: 刘欣 码农翻身 2016-07-10 摘要:手工Build的烦恼要不是为了和女朋友留在一个城市,小李肯定去北上广奋斗去了.现在他只能留在这个2.5线城市,进入这家软 ...

  9. java项目构建工具Maven

    一.java-maven常用命令 mvn archetype:create 创建Maven项目 mvn compile 编译源代码 mvn deploy 发布项目 mvn test-compile 编 ...

随机推荐

  1. centos7 安装jdk8 bash脚本 并配置环境变量

    #!/bin/bash #安装java脚本 if type -p java; then echo 'java已安装.' exit else echo '开始安装java...' wget --no-c ...

  2. linux 清空文件

    将Linux文件清空的几种方法 1.使用重定向的方法 [root@centos7 ~]# du -h test.txt 4.0K test.txt [root@centos7 ~]# > tes ...

  3. Docker技术综述

    从技术入门到实战:docker初步尝试 docker中文社区 容器和镜像的导入和导出

  4. redis 五大数据类型之hash篇

    1.hset/hget/hmset/hmget/hgetall/hdel --hgetall 是以截图中 key-value 分别一一显示出来,k1对应v1 ,k2对应v2 2.hlen 3.hexi ...

  5. oracle截取字段中的部分字符串

    使用Oracle中Instr()和substr()函数: 在Oracle中可以使用instr函数对某个字符串进行判断,判断其是否含有指定的字符. 其语法为: instr(sourceString,de ...

  6. phpexcel 的使用

    首先到phpexcel官网上下载最新的phpexcel类,下周解压缩一个classes文件夹,里面包含了PHPExcel.php和PHPExcel的文件夹,这个类文件和文件夹是我们需要的,把class ...

  7. REST easy with kbmMW #20 – OpenAPI and Swagger UI

    即将推出的kbmMW更新不仅是一些bug修正,同时将包含一个新的主要功能:客户端存根生成器框架. 那什么是客户端存根生成器框架呢? 他是一个基于kbmMW smart services,可以生成由各种 ...

  8. Maven安装Oracle驱动包到本地仓库

    驱动下载地址:https://download.csdn.net/download/yang_lover/9455401 mvn install:install-file -DgroupId=com. ...

  9. Selenium之ActionChains(一)

    今天,分享的是ActionChains的使用方法. 先来说一下今天要用到的方法: click(element=null)                                 点击元素,参数 ...

  10. Stiring公式证明