下载安装

下载地址

改动默认端口:

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. jq demo—图片翻页展示效果 animate()动画

    <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...

  2. 打开和写入word文档

    一. 使用win32读取word内容 # -*- coding: utf-8 -*- from win32com import client as wc def readDocx2(): word = ...

  3. Docker(3):Dockerfile介绍及简单示例

    Dockerfile 概念 Dockerfile是由一系列命令和参数构成的脚本,这些命令应用于基础镜像并最终创建一个新的镜像.它们简化了从头到尾的流程并极大的简化了部署工作.Dockerfile从FR ...

  4. day 26面向对象 的封装 接口 抽象

    大纲分析 # 面向对象# 类 :一类具有相同属性和方法的事物 #类的定义:class #类中可以定义的方法种类: #普通方法 self 对象 #类方法 cls @classmethod 类/对象 #静 ...

  5. vnode的挂载和更新流程 -- 简介.

    来源 vnode原理 diff图解 <div id="app"> {{someVar}} </div> <script type="text ...

  6. Oracle使用exp和imp导出、导入数据

    ===========导出============ exp 用户名/密码@服务器(localhost) file=文件路径.dmp owner=(用户名) ===========导入========= ...

  7. IDEA PYCHARM USAGE NOTE

    初次安装使用PyCharm,在新建.py文件时会发现文件头并没有什么信息,因此,使用模板会比较方便. 方法如下: 1.打开PyCharm,选择File--Settings 2.依次选择Editor-- ...

  8. Python 实例方法

    class Computer: # 实例方法 def play(self): print("电脑可以扫雷") # 在定义实例方法的时候. 必须给出一个参数 self # 形参的第一 ...

  9. Java 经典面试题 —— 性能

    1. 性能 String.StringBuffer 与 StringBuilder 两个字符串相加,str1+str2,相当于执行: StringBuilder strBuilder1 = new S ...

  10. insserv: warning: script 'busybox-httpd' missing LSB tags and overrides

    /********************************************************************************* * insserv: warnin ...