一、 重写 super pom

修改 maven 的 settings.xml

Configuring Maven to Use a Single Repository Group

  1. <settings>
  2. <mirrors>
  3. <mirror>
  4. <!--This sends everything else to /public -->
  5. <id>nexus</id>
  6. <mirrorOf>*</mirrorOf>
  7. <url>http://localhost:8081/nexus/content/groups/public</url>
  8. </mirror>
  9. </mirrors>
  10. <profiles>
  11. <profile>
  12. <id>nexus</id>
  13. <!--Enable snapshots for the built in central repo to direct -->
  14. <!--all requests to nexus via the mirror -->
  15. <repositories>
  16. <repository>
  17. <id>central</id>
  18. <url>http://central</url>
  19. <releases><enabled>true</enabled></releases>
  20. <snapshots><enabled>true</enabled></snapshots>
  21. </repository>
  22. </repositories>
  23. <pluginRepositories>
  24. <pluginRepository>
  25. <id>central</id>
  26. <url>http://central</url>
  27. <releases><enabled>true</enabled></releases>
  28. <snapshots><enabled>true</enabled></snapshots>
  29. </pluginRepository>
  30. </pluginRepositories>
  31. </profile>
  32. </profiles>
  33. <activeProfiles>
  34. <!--make the profile active all the time -->
  35. <activeProfile>nexus</activeProfile>
  36. </activeProfiles>
  37. </settings>

补充:

目的是只使用nexus

http://maven.apache.org/ref/3.0.4/maven-model-builder/super-pom.html

二、修改项目中pom文件

1. 指定仓库

  1. <repositories>
  2. <repository>
  3. <id>nexus</id>
  4. <name>nexus</name>
  5. <url>http://localhost:8081/nexus/content/groups/public/</url>
  6. <releases>
  7. <enabled>true</enabled>
  8. </releases>
  9. <snapshots>
  10. <enabled>true</enabled>
  11. </snapshots>
  12. </repository>
  13. </repositories>
  14. <pluginRepositories>
  15. <pluginRepository>
  16. <id>nexus</id>
  17. <name>nexus</name>
  18. <url>http://localhost:8081/nexus/content/groups/public/</url>
  19. <releases>
  20. <enabled>true</enabled>
  21. </releases>
  22. <snapshots>
  23. <enabled>true</enabled>
  24. </snapshots>
  25. </pluginRepository>
  26. </pluginRepositories>

2. 设置部署

项目中pom.xml文件

  1. <distributionManagement>
  2. <repository>
  3. <id>user-releases</id>
  4. <name>user-releases</name>
  5. <url>http://localhost:8081/nexus/content/repositories/releases/</url>
  6. </repository>
  7.  
  8. <snapshotRepository>
  9. <id>user-snapshots</id>
  10. <name>user-snapshots</name>
  11. <url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
  12. </snapshotRepository>
  13. </distributionManagement>

maven的setting.xml

  1. <servers>
  2. <server>
  3. <id>user-releases</id>
  4. <username>admin</username>
  5. <password>admin123</password>
  6. </server>
  7. <server>
  8. <id>user-snapshots</id>
  9. <username>admin</username>
  10. <password>admin123</password>
  11. </server>
  12. </servers>

补充:

目的是 mvn clean deploy 时自动部署到私服

http://maven.apache.org/ref/3.0.4/maven-model/maven.html#class_distributionManagement

关于部署到 repository OR snapshotRepository

查询资料

  1. Prepare a Release
  2. Preparing a release goes through the following release phases:
  3.  
  4. Check that there are no uncommitted changes in the sources
  5. Check that there are no SNAPSHOT dependencies
  6. Change the version in the POMs from x-SNAPSHOT to a new version (you will be prompted for the versions to use)
  7. Transform the SCM information in the POM to include the final destination of the tag
  8. Run the project tests against the modified POMs to confirm everything is in working order
  9. Commit the modified POMs
  10. Tag the code in the SCM with a version name (this will be prompted for)
  11. Bump the version in the POMs to a new value y-SNAPSHOT (these values will also be prompted for)
  12. Commit the modified POMs

实际测试

  1. <version>0.0.1-SNAPSHOT</version>

版本号加-SNAPSHOT 会自动部署到Snapshots仓库,格式必须为 【版本号-SNAPSHOT】

生的jar包自动添加时间戳 例如:0.0.1-20160315.073435-1.jar

去掉-SNAPSHOT 则会部署到releases 仓库

http://maven.apache.org/maven-release/maven-release-plugin/examples/prepare-release.html

三、手动上传组件

1. 登录nexus

2. 选择目标仓库

3. 选择Tab [Artifact Upload]

4. 完善组件信息

备注:Snapshots 仓库不能手动上传

四、设置代理

1. 登录nexus

2. 进入仓库管理添加代理

五、仓库类型

group、hosted、proxy、virtual

group由三类组成

宿主再分三类

代理一开始有3个

http://books.sonatype.com/nexus-book/reference/confignx-sect-manage-repo.html

六、删除私服中的组件

右键删除即可

七、查找并使用组件

登录 nexus

search

就看到组件坐标

nexus 组件下载和上传的更多相关文章

  1. 从Nexus私服下载和上传资源(一)

    从私服中下载资源 首先要明确将资源下载到哪里 找到maven 配置文件settings.xml 文件,添加如下配置:1.添加镜像配置:将所有访问外网仓库的请求指向私服: <mirror> ...

  2. 从Nexus私服下载和上传资源(二)

    上传资源到私服 当项目完成后如果需要deploy 部署jar 包到私服,则可以添加如下配置: 1.在项目的 pom.xml 文件中添加上传部署的路径: 注意:如果需要对 releases版本进行多次部 ...

  3. 重新想象 Windows 8 Store Apps (66) - 后台任务: 下载和上传

    [源码下载] 重新想象 Windows 8 Store Apps (66) - 后台任务: 下载和上传 作者:webabcd 介绍重新想象 Windows 8 Store Apps 之 后台任务 后台 ...

  4. 重新想象 Windows 8.1 Store Apps (91) - 后台任务的新特性: 下载和上传的新特性, 程序启动前预下载网络资源, 后台任务的其它新特性

    [源码下载] 重新想象 Windows 8.1 Store Apps (91) - 后台任务的新特性: 下载和上传的新特性, 程序启动前预下载网络资源, 后台任务的其它新特性 作者:webabcd 介 ...

  5. github下载和上传项目

    git下载和上传项目 下载: git clone +地址 上传: 1.git init 在当前项目的目录中生成本地的git管理(多一个.git文件夹,为隐藏文件) 2.git add .(注意最后面有 ...

  6. 使用MFC提供的Http类下载和上传文件

    1.下载文件 Download(const CString& strFileURLInServer, //待下载文件的URL const CString & strFileLocalF ...

  7. 2.4 利用FTP服务器下载和上传目录

    利用FTP服务器下载目录 import os,sys from ftplib import FTP from mimetypes import guess_type nonpassive = Fals ...

  8. 2.3 利用FTP服务器下载和上传文件

    二.利用FTP服务器的下载文件 from ftplib import FTP from os.path import exists def getfile(file,site,dir,user=(), ...

  9. 在XShell中使用sz和rz命令下载和上传文件

    借助XShell,使用linux命令sz可以很方便的将服务器上的文件下载到本地,使用rz命令则是把本地文件上传到服务器 工具/原料   XShell CentOS 6.5 使用sz下载文件   1 输 ...

随机推荐

  1. vue 引入bootstarp --webpack

    注意对应好版本 - 稳定版本 :"bootstrap": "^3.0.0"  否则样式异常, 1.npm install jquery --save-dev 引 ...

  2. ASP.Net 下载大文件的实现

    当我们的网站需要支持下载大文件时,如果不做控制可能会导致用户在访问下载页面时发生无响应,使得浏览器崩溃.可以参考如下代码来避免这个问题. 关于此代码的几点说明: 1. 将数据分成较小的部分,然后将其移 ...

  3. Scrapy简单入门及实例讲解-转载

    Scrapy是一个为了爬取网站数据,提取结构性数据而编写的应用框架. 其可以应用在数据挖掘,信息处理或存储历史数据等一系列的程序中.其最初是为了页面抓取 (更确切来说, 网络抓取 )所设计的, 也可以 ...

  4. etcd ui

    https://github.com/henszey/etcd-browser docker build --build-arg http_proxy=http://109.105.4.17:3128 ...

  5. 《Blue Flke》第一次作业:团队亮相

    1.队名:Blue Flke 团队格言:决心是成功的力量,耐心是成功的保障. 2.团队成员组成:  201571030129/ 王胜海 (组长)  201571030126/ 妥志福 20157103 ...

  6. VMware克隆CentOS网络配置

    配置网络 如果是克隆CentOS的: vi /etc/udev/rules.d/70-persistent-net.rules 注释掉网络eth0,把最后一个改为eth0,记录下mac地址. vi / ...

  7. mybatis遍历array数组与集合、json

    遍历数组: int saveOptions(@Param("items")String[] items, @Param("questionId")int que ...

  8. 53. Maximum Subarray最大求和子数组12 3(dp)

    [抄题]: Find the contiguous subarray within an array (containing at least one number) which has the la ...

  9. swift - VFL

    1.VFL语法总结: //(1)“H”表示水平方向,“V”表示垂直方向 //(2)“|”表示父视图的边界 //(3)“[]”表示这是一个视图UIView的子类,可以组合多个条件,条件用"() ...

  10. OrgChart 组织架构与PHP结合使用

    一.OrgChart下载地址: https://github.com/dabeng/OrgChart 二.组织架构的表设计 CREATE TABLE `org_info` ( `id` int(11) ...