一、在setting中配置 私服的镜像,在mirrors标签中加上:

<!--第一步  配置私服的镜像-->
<mirror>
<!--此处配置所有的构建均从私有仓库中下载 *代表所有,也可以写central -->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<!-- url对应发私服的 Public Repositories -->
<url>http://localhost:8081/nexus/content/groups/public/</url>
</mirror>

二、nexus工厂的配置,在profiles标签中加上:

<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配置

<!--第三步  激活profile配置 -->
<activeProfiles>
<!--make the profile active all the time -->
<activeProfile>nexus</activeProfile>
</activeProfiles>

四、在pom.xml中配置

<repositories>
<repository>
<id>central</id>
<url>http://localhost:8081/nexus/content/groups/public/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://localhost:8081/nexus/content/groups/public/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>

前四步 maven私服已经搭建成功,后面步骤 是将 jar 上传到 私服

五、在nexus中配置权限

  1.新建仓库,便于管理

  

  2.在Nexus中新建权限

  

  

  3.添加角色,并给角色授予权限

  

  4.添加用户,并给用户授予角色

  

六、配置上传到私服,在pom中:

<distributionManagement>
<repository>
<id>test-party</id>
<name>test-user</name>
<url>http://localhost:8081/nexus/content/repositories/test-party</url>
</repository>
</distributionManagement>

 id 对应刚刚 新建的maven库的id,url对应刚刚新建的maven库的url,如下: 

  

 name对应刚刚新建的用户名:test-user

七、在pom.xml的servers标签中加上:

<server>
<id>test-party</id>
  <username>test-user</username>
  <password>xbq</password>
</server>

八、执行deploy,发布到私服

  选中项目,run as -- maven build ... ,在Goals中输入 deploy ,其他的不需要填写,执行Run,当看到控制台上 出现 BUILD SUCCESS,则成功!

九、在nexus中查看是否发布上去

  

注意:更新jar遇到错误:

  was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced

  解决办法:去自己的.m2 文件夹下把 xxx.lastUpdated 文件全部删掉,重新运行maven,ok!

新建的maven工程默认是jdk1.5,怎么换成jdk1.7呢?

  在profiles标签中加入:

    <profile>
<id>jdk-1.7</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.7</jdk>
</activation>
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.compilerVersion>1.7</maven.compiler.compilerVersion>
</properties>
</profile>

Maven(二)-- 搭建私服,上传jar的更多相关文章

  1. Nexus3.0搭建私服上传JAR包 Windows10

    背景 近期换了一个项目组,用的是公司自研产品,涉及到很多内部JAR包引用,版本号很多,每次更新都是产品部给出jar包,项目组成员各自复制一套本地替换,来了新人各种安装配置,复杂度太高,这不,我一来,又 ...

  2. maven命令学习-发布上传jar包-deploy

    Maven学习六之利用mvn deploy命令上传包 转http://blog.csdn.net/woshixuye/article/details/8133050 mvn:deploy在整合或者发布 ...

  3. maven私服上传jar包

    将一下脚本保存在.bat文件执行,红色部分按实际情况修改: @echo off set groupId=com.xxxset artifactId=xxxset version=0.0.1set ja ...

  4. 【转】上传jar包到nexus私服

    原文:https://my.oschina.net/lujianing/blog/297128 1通过网页上传 这种方法只是上传了jar包.通过maven引用当前jar,不能取得jar的依赖 from ...

  5. Maven第四篇【私有仓库、上传jar包、引用私服jar包、上传本地项目到私服】

    搭建私有服务器 前面已经说过了,我们使用Maven的使用,如果需要导入相对应的jar包,Maven首先会在我们的本地仓库中寻找->私有仓库->中心仓库- 然而,我们的本地仓库常常没有想要的 ...

  6. maven上传jar包到nexus私服后的存放路径 以及 使用IDEA上传jar包的步骤

    maven上传jar包到nexus私服的方法,网上大神详解很多,那么上传后的jar包存放到哪里了呢? 在下使用nexus3.2.1版本,在本地搭建了私服,使用maven上传jar包.最后结果如下: 点 ...

  7. 实测Maven上传jar包到私服的方法归纳

    Hello,各位小伙伴大家好,我是小栈君.好久不见,最近因为工作的缘故,导致了更新变慢,但是小栈君也在积极的做素材的规划,毕竟学习知识点的归纳和提炼需要一定的时间. 所以还请大家多多见谅,下一期的分享 ...

  8. Maven上传jar包到私服

    1.认证,在M2_HOME/conf/settings.xml配置用户名密码 <server> <id>releases</id> <username> ...

  9. (转)上传jar包到nexus私服

    场景:在使用私服Nexus时候经常需要上传jar包,但是对上传jar包的方式不是很熟悉,所以很有必要学习下. 1 通过网页上传 GAV Definition:选择GAV Parameters 输入JA ...

  10. 通过maven 上传jar 到nexus3,cong nexus3下载jar

    nexus是一种常见的maven私服软件. 网上介绍的都是nexus2的使用,下面是最新版nexus3的使用方式. 首先需要从官网下载nexus3的包,很卡. 下载好以后解压会有两个文件夹:nexus ...

随机推荐

  1. LeetCode: Binary Tree Preorder Traversal 解题报告

    Binary Tree Preorder Traversal Given a binary tree, return the preorder traversal of its nodes' valu ...

  2. Python深入学习之内存管理

    语言的内存管理是语言设计的一个重要方面.它是决定语言性能的重要因素.无论是C语言的手工管理,还是Java的垃圾回收,都成为语言最重要的特征.这里以Python语言为例子,说明一门动态类型的.面向对象的 ...

  3. 一款纯css3实现的数字统计游戏

    今天给大家分享一款纯css3实现的数字统计游戏.这款游戏的规则的是将所有的数字相加等于72.这款游戏的数字按钮做得很美观,需要的时候可以借用下.一起看下效果图: 在线预览   源码下载 实现的代码. ...

  4. dubbo2.5.3注解版

    1.环境      在机器192.168.0.4机器上安装了zookeeper,用于dubbo的服务注册,安装教程在另外一篇博客 http://www.cnblogs.com/520playboy/p ...

  5. 通过SiteMapDataSource动态获取SiteMap文件进行权限设置

    最近做一个用ASP.NET做一个小项目,用户不是很多,功能不算太复杂,但是做到权限控制的时候有点犯难,这么一个小系统如果全部做一个大的复杂的权限控制觉得成本不划算,打算用Treeview ,根据不同的 ...

  6. Apache HttpComponents Custom protocol interceptors通过拦截器自定义压缩

    /* * ==================================================================== * Licensed to the Apache S ...

  7. Mac为nginx安装nginx-sticky-module

    Mac为nginx安装nginx-sticky-module nginx版本: nginx-1.9.8 nginx-sticky-module版本:nginx-sticky-module-ng *注意 ...

  8. AI,DM,ML,PR的区别与联系

    数据挖掘和机器学习的区别和联系,周志华有一篇很好的论述<机器学习与数据挖掘>可以帮助大家理解.数据挖掘受到很多学科领域的影响,其中数据库.机器学习.统计学无疑影响最大.简言之,对数据挖掘而 ...

  9. 公司内网成功实现WSUS在不连外网的条件下更新补丁包!

    微软的WSUS的命令行很有帮助! 为了便于管理,WSUS服务器中提供了一个命令行工具WSUSUtil.exe,你可以使用它完成一些在WSUS管理控制台中不能进行的任务,例如导入导出数据等等.WSUSU ...

  10. Framework 7 日历插件改成Picker 模式

    Framework 7 里面的日历插件默认的2种模式: 1.文本框 2.直接展示 如下图: 更多例子点这里 而我的需求如下图: 点击小图标再弹出日历,选择某个日期,隐藏日历弹层. 实现步骤: 1.写小 ...