Nexus3.6安装、setting配置和jar包deploy
来源:互联网 发布:初中优化测试卷答案 编辑:程序博客网 时间:2024/06/06 08:56
1.下载
http://www.sonatype.com/download-oss-sonatype
2.安装/卸载(install\uninstall)【本文以Windows环境为例】
cmd进入到解压目录:
E:\nexus3.6\nexus-3.6.1-02-win64\nexus-3.6.1-02\bin
E:\nexus3.6\nexus-3.6.1-02-win64\nexus-3.6.1-02\bin>nexus.exe /install
Installed service 'nexus'.
3.启动服务
cmd窗口:输入services.msc 找到nexus服务,点击启动
4.访问端口配置
进入E:\nexus3.6\nexus-3.6.1-02-win64\nexus-3.6.1-02\etc目录,打开nexus-default.properties文件
,找到application-port=9090,修改成你自己的端口
## DO NOT EDIT - CUSTOMIZATIONS BELONG IN $data-dir/etc/nexus.properties
##
# Jetty section
application-port=8081
application-host=0.0.0.0
nexus-args=${jetty.etc}/jetty.xml,${jetty.etc}/jetty-http.xml,${jetty.etc}/jetty-requestlog.xml
nexus-context-path=/
# Nexus section
nexus-edition=nexus-pro-edition
nexus-features=\
nexus-pro-feature
5.启动/停止nexus
cmd窗口 -> net start nexus(启动服务)
net stop nexus(停止服务)
6.访问地址
http://ip:端口/
默认账号密码:admin/admin123
7.访问地仓库类型
hosted 宿主仓库:主要用于部署无法从公共仓库获取的构件(如 oracle 的 JDBC 驱动)以及自己或第三方的项目构件;
proxy 代理仓库:代理公共的远程仓库;
group 仓库组:Nexus 通过仓库组的概念统一管理多个仓库,这样我们在项目中直接请求仓库组即可请求到仓库组管理的多个仓库。
8.配置私服(settings.xml)
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<!--设置的maven本地仓库-->
<localRepository>D:\Java\Maven\m2\repository</localRepository>
<pluginGroups/>
<proxies/>
<!--配置服务端的一些设置。一些设置如安全证书不应该和pom.xml一起分发。这种类型的信息应该存在于构建服务器上的settings.xml文件中。 -->
<servers>
<server>
<!--这是server的id(注意不是用户登陆的id),该id与distributionManagement中repository元素的id相匹配。 -->
<id>nexus</id>
<!--nexus中配置的用户名密码-->
<username>admin</username>
<password>admin123</password>
</server>
<!--将项目发布到私服中需要用到-->
<server>
<!--这是server的id(注意不是用户登陆的id),该id与distributionManagement中repository元素的id相匹配。 -->
<id>newcapec-zhifu-releases</id>
<!--nexus中配置的用户名密码-->
<username>admin</username>
<password>admin123</password>
</server>
<!--将项目发布到私服中需要用到-->
<server>
<!--这是server的id(注意不是用户登陆的id),该id与distributionManagement中repository元素的id相匹配。 -->
<id>newcapec-zhifu-snapshots</id>
<!--nexus中配置的用户名密码-->
<username>admin</username>
<password>admin123</password>
</server>
</servers>
<!--为仓库列表配置的下载镜像列表。 -->
<mirrors>
<mirror>
<!--该镜像的唯一标识符。id用来区分不同的mirror元素。 -->
<id>nexus</id>
<!--此处配置所有的构建均从私有仓库中下载 *代表所有,也可以写central -->
<mirrorOf>*</mirrorOf>
<name>central repository</name>
<!--该镜像的URL。构建系统会优先考虑使用该URL,而非使用默认的服务器URL。 -->
<url>http://192.168.112.61:8081/repository/maven-public/</url>
</mirror>
</mirrors>
<!--根据环境参数来调整构建配置的列表。settings.xml中的profile元素是pom.xml中profile元素的裁剪版本。-->
<!--它包含了id,activation, repositories, pluginRepositories和 properties元素。-->
<!--这里的profile元素只包含这五个子元素是因为这里只关心构建系统这个整体(这正是settings.xml文件的角色定位),而非单独的项目对象模型设置。-->
<!--如果一个settings中的profile被激活,它的值会覆盖任何其它定义在POM中或者profile.xml中的带有相同id的profile。 -->
<profiles>
<profile>
<id>nexus</id>
<!--远程仓库列表,它是Maven用来填充构建系统本地仓库所使用的一组远程项目。 -->
<repositories>
<!--发布版本仓库-->
<repository>
<id>nexus</id>
<!--name随便-->
<name>Nexus Release Snapshot Repository</name>
<!--地址是nexus中repository(Releases/Snapshots)中对应的地址-->
<url>http://192.168.112.61:8081/repository/maven-releases/</url>
<!--true或者false表示该仓库是否为下载某种类型构件(发布版,快照版)开启。 -->
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<!--发现插件的远程仓库列表。仓库是两种主要构件的家。第一种构件被用作其它构件的依赖。这是中央仓库中存储的大部分构件类型。另外一种构件类型是插件。-->
<!--各节点的含义和repository是一样的-->
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>Nexus Release Snapshot Repository</name>
<url>http://192.168.112.61:8081/repository/maven-releases/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
<!--设置maven编译器级别-->
<profile>
<id>jdk18</id>
<activation>
<!--profile默认是否激活的标识 -->
<activeByDefault>true</activeByDefault>
<!--activation有一个内建的java版本检测,如果检测到jdk版本与期待的一样,profile被激活。 -->
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>
</profiles>
<!--激活配置-->
<activeProfiles>
<!--profile下的id-->
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>
9.上传jar包到Nexus
- pom方式:
pom.xml中添加,和dependencies属于同一级别,在project级别下
<!--将项目发布到私服中--><distributionManagement> <repository> <id>newcapec-zhifu-releases</id> <name>newcapec-zhifu-releases</name> <url>http://192.168.112.61:8081/repository/newcapec-zhifu-releases/</url> </repository> <snapshotRepository> <id>newcapec-zhifu-snapshots</id> <name>newcapec-zhifu-snapshots</name> <url>http://192.168.112.61:8081/repository/newcapec-zhifu-snapshots/</url> </snapshotRepository></distributionManagement>
id为要上传的repository的唯一标示,url为要上传的repository的路径
mvn deploy即可
- 命令方式:
mvn deploy:deploy-file -DgroupId=xxx.xxx -DartifactId=xxx -Dversion=0.0.2 -Dpackaging=jar
-Dfile=D:\xxx.jar -Durl=http://xxx.xxx.xxx.xxx:8081/repository/3rdParty/ -DrepositoryId=3rdParty
其中-DgroupId 为上传的jar的groupId
-DartifactId 为上传的jar的artifactId
-Dversion 为上传的jar的需要被依赖的时候的版本号
然后是-Dpackaging为jar,-Dfile为jar包路径
-Durl 为要上传的路径,可以通过以下方式获取到
-DrepositoryId 为repository的唯一标示,跟第二步中赋权配置的server相同
参考来源:http://blog.csdn.net/iopfan/article/details/71107686
阅读全文
1 0
- Nexus3.6安装、setting配置和jar包deploy
- nexus3添加jar包
- nexus3.XX的下载安装和配置
- nexus3.1配置安装
- Maven为web项目同时打jar和war包,deploy时只上传jar包的配置
- nexus3.3.1上传第三方jar包
- nexus3.3.1上传第三方jar包
- nexus3.3.1上传第三方jar包
- Windows安装配置Nexus3.6与Maven3.3.9配置
- Nexus3.6 window版私服搭建 安装、配置教程
- Nexus3.6 命令行方式上传 jar文件
- [转]nexus3.3.1上传第三方jar包
- maven 上传第三方jar包到 nexus3.4
- linux nexus3.0.1 jdk1.8 安装配置
- linux nexus3.0.1 jdk1.8 安装配置
- tomcat配置数据源和jar包引入
- struts的jar包和配置
- 导入和配置第三方jar包
- 链式栈及几种操作
- LeetCode-Easy刷题(22)Binary Tree Level Order Traversal II
- 淘宝天猫京东亚马逊商品信息采集-商品售价、销量、图片采集
- mysql的sql执行计划详解
- LeetCode-Easy刷题(23) Convert Sorted Array to Binary Search Tree
- Nexus3.6安装、setting配置和jar包deploy
- redis在centos7下的不同主机设置主从关系连接不上的问题
- Redis简介
- 【信号与系统】如果看了此文你还不懂傅里叶变换,那就过来掐死我吧【完整版】
- Java应用系列:命令行生成jar包(附IJ Idea导出jar方法)
- 数据库死锁
- 更新package.json的方法
- 环境迁移到新的linux环境
- Redis安装