举例

1. 依赖如下:

  1. <dependency>
  2. <groupId>org.quartz-scheduler.internal</groupId>
  3. <artifactId>quartz-terracotta-bootstrap</artifactId>
  4. <version>2.2.2-SNAPSHOT</version>
  5. </dependency>

将Jar包安装到本地仓库命令:

  1. mvn install:install-file -Dfile=D:\quartz-terracotta-bootstrap-2.2.2-SNAPSHOT.jar -DgroupId=org.quartz-scheduler.internal -DartifactId=quartz-terracotta-bootstrap -Dversion=2.2.2-SNAPSHOT -Dpackaging=jar

-- DgroupId和DartifactId构成了该jar包在pom.xml的坐标, 对应依赖的DgroupId和DartifactId
-- Dfile表示需要上传的jar包的绝对路径
-- Dpackaging 为安装文件的种类

2. 上传Jar到私服

命令:

  1. mvn deploy:deploy-file -DgroupId=org.terracotta.toolkit -DartifactId=terracotta-toolkit-api-internal -Dversion=1.12 -Dpackaging=jar -Dfile=D:\terracotta-toolkit-api-internal-1.12.jar -Durl=http://ip:port/nexus/content/repositories/thirdparty/ -DrepositoryId=thirdparty

-- DgroupId和DartifactId构成了该jar包在pom.xml的坐标, 对应依赖的DgroupId和DartifactId
-- Dfile表示需要上传的jar包的绝对路径
-- Durl私服上仓库的url精确地址(打开nexus左侧repositories菜单,可以看到该路径)
-- DrepositoryId服务器的表示id,在nexus的configuration可以看到

mvn install:install-file  -Dfile=D:\test\com.exmyth.gprinter.jar  -DgroupId=com.exmyth  -DartifactId=gprinter -Dversion=1.0 -Dpackaging=jar

mvn install:install-file -DgroupId=com.exmyth -DartifactId=gprinter -Dversion=1.0 -Dfile=D:\test\com.exmyth.gprinter.jar -Dpackaging=jar -DgeneratePom=true -DlocalRepositoryPath=D:\test\mvn -DcreateChecksum=true

mvn deploy:deploy-file -DgroupId=com.exmyth -DartifactId=gprinter -Dversion=1.0 -Dpackaging=jar -Dfile=D:\test\com.exmyth.gprinter.jar -Durl=http://192.168.199.182:9091/nexus/content/repositories/thirdparty/ -DrepositoryId=thirdparty

本地

D:\test\mvn>mvn install:install-file  -Dfile=D:\test\com.exmyth.gprinter.jar  -D
groupId=com.exmyth -DartifactId=gprinter -Dversion=1.0 -Dpackaging=jar
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM)
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom
---
[INFO] Installing D:\test\com.exmyth.gprinter.jar to D:\repository\com\exmyth\gp
rinter\1.0\gprinter-1.0.jar
[INFO] Installing C:\Users\WPWL\AppData\Local\Temp\mvninstall8371599131162576038
.pom to D:\repository\com\exmyth\gprinter\1.0\gprinter-1.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.528 s
[INFO] Finished at: --21T13::+:
[INFO] Final Memory: 7M/123M
[INFO] ------------------------------------------------------------------------

私服

D:\test\mvn>mvn deploy:deploy-file -DgroupId=com.exmyth -DartifactId=gprinter -D
version=1.0 -Dpackaging=jar -Dfile=D:\test\com.exmyth.gprinter.jar -Durl=http://
192.168.199.182:/nexus/content/repositories/thirdparty/ -DrepositoryId=third
party
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM)
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-deploy-plugin:2.7:deploy-file (default-cli) @ standalone-pom --
-
Uploading: http://192.168.199.182:9091/nexus/content/repositories/thirdparty/com
/exmyth/gprinter/1.0/gprinter-1.0.jar
Uploading: http://192.168.199.182:9091/nexus/content/repositories/thirdparty/com
/exmyth/gprinter/1.0/gprinter-1.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.726 s
[INFO] Finished at: --21T14::+:
[INFO] Final Memory: 8M/155M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:
deploy-file (default-cli) on project standalone-pom: Failed to deploy artifacts:
Could not transfer artifact com.exmyth:gprinter:jar:1.0 from/to thirdparty (htt
p://192.168.199.182:9091/nexus/content/repositories/thirdparty/): Failed to tran
sfer file: http://192.168.199.182:9091/nexus/content/repositories/thirdparty/com
/exmyth/gprinter/1.0/gprinter-1.0.jar. Return code is: , ReasonPhrase: Unauth
orized. -> [Help ]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help ] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception D:\test\mvn>

将Jar安装到本地仓库和Jar上传到私服的更多相关文章

  1. Maven:将Jar安装到本地仓库和Jar上传到私服

    1.依赖如下: <dependency> <groupId>org.quartz-scheduler.internal</groupId> <artifact ...

  2. Maven : 将Jar安装到本地仓库和Jar上传到私服 转

    http://blog.csdn.net/we_shell/article/details/49819221 Jar的maven配置 <dependency><groupId> ...

  3. maven如何将本地jar安装到本地仓库

    1.首先确认你的maven是否已经配置: 指令:mvn -v 2.本地的jar包位置: 3.在自己项目pom.xml中添加jar依赖: <dependency> <groupId&g ...

  4. github将本地仓库的代码上传到Github

    本篇主要参考博文:https://blog.csdn.net/IT_faquir/article/details/52516214 你要先完成上一篇的操作,即将代码上传到本地仓库中,才能上传到gith ...

  5. Maven 手动把本地jar安装到本地仓库

    首先,你要安装的.jar包要下载下来放在电脑上面,然后maven已经配置好了,如下图: 然后,执行一下命令就可以了 mvn install:install-file -Dfile=path-to-fi ...

  6. maven——将jar安装到本地仓库

    环境变量MAVEN_HOME配置正确后,cmd窗口执行此命令: mvn install:install-file -Dfile=C:\hehe.jar  -DgroupId=com.rockontro ...

  7. git入门手册:git的基本安装,本地库管理,远程上传

    前言: git是分布式的版本库控制系统,它能方便你将自己的代码寄存于远程服务器上,从而实现集体合作开发.git有GUI 图形界面,然而使用终端命令仍是主流.以下基于Ubuntu系统操作git(其方式也 ...

  8. 本地jar包安装到本地仓库

    将本地jar包安装到本地仓库中,记得参数上有双引号 mvn install:install-file -Dfile="jar全路径" -DgroupId="groupId ...

  9. 本地jar包 安装到本地仓库中的命令

    maven 项目 本地jar包 安装到本地仓库中去: 首先进入到该文件所在文件夹内 若不在直接绝对路径就可以.注意命令中的空格 mvn install:install-file  -Dfile=文件名 ...

随机推荐

  1. 测试SQL基础知识

    SQL DML 和 DDL 可以把 SQL 分为两个部分:数据操作语言 (DML) 和 数据定义语言 (DDL). SQL (结构化查询语言)是用于执行查询的语法.但是 SQL 语言也包含用于更新.插 ...

  2. go语言godep使用命令

    godep 看见他的star比govendor,所以我使用它.官方地址 https://github.com/tools/godep install   1 go get github.com/too ...

  3. python的partition() 方法

    描述 partition() 方法用来根据指定的分隔符将字符串进行分割. 如果字符串包含指定的分隔符,则返回一个3元的元组,第一个为分隔符左边的子串,第二个为分隔符本身,第三个为分隔符右边的子串. p ...

  4. Java-Runoob-高级教程-实例-数组:01. Java 实例 – 数组排序及元素查找

    ylbtech-Java-Runoob-高级教程-实例-数组:01. Java 实例 – 数组排序及元素查找 1.返回顶部 1. Java 实例 - 数组排序及元素查找  Java 实例 以下实例演示 ...

  5. asp.net mvc4 controller

    controller返回几种返回结果

  6. Linux 系统管理命令 - free - 查看系统内存信息

    命令详解 重要星级: ★★★★★ 功能说明: free 命令用于显示系统内存状态,具体包括系统物理内存.虚拟内存.共享内存和系统缓存等. 语法格式: free [option] free [选项] 说 ...

  7. ES6躬行记(23)——Promise的静态方法和应用

    一.静态方法 Promise有四个静态方法,分别是resolve().reject().all()和race(),本节将着重分析这几个方法的功能和特点. 1)Promise.resolve() 此方法 ...

  8. 点击button传递消息,但是页面不跳转的解决方法

    最近在做一个物联网的项目时遇到的问题:界面上有很多控制开/关灯的button,通过点击button来控制各个灯的亮灭.我需要将获取的不同的点击事件消息,以Socket通信的方式发送给硬件端的服务监听程 ...

  9. bzoj 2743: [HEOI2012]采花【树状数组】

    离线,按照l排序 注意到在区间里出现两次的颜色才有贡献,所以记录一个ne[i]表示i后第一个和i同色的花,维护一个l,每次处理询问的时候l单调右移,树状数组维护,在ne[ne[i]]位置++,在ne[ ...

  10. 配置Ubuntu16.04第03步:安装搜狗输入法

    1.进入搜狗官网:https://pinyin.sogou.com/linux/ ,下载搜狗输入法安装包 2.使用dpkg命令安装Deb包: sudo dpkg -i sogoupinyin_2.0. ...