举例

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. poj-1655 Balancing Act(树的重心+树形dp)

    题目链接: Balancing Act Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 11845   Accepted: 4 ...

  2. 《Image-to-Image Translation with Conditional Adversarial Networks》论文笔记

    出处 CVPR2017 Motivation 尝试用条件GAN网络来做image translation,让网络自己学习图片到图片的映射函数,而不需要人工定制特征. Introduction 作者从不 ...

  3. Html.PartialView(),html.Renderpartial,html.action.html.RenderAction 辅助方法

    Html.Partial(), 返回HTML字符串 .参数为部分视图 html.RenderPartial(),不返回返回HTML字符串 ,直接输出响应流.参数为部分视图 一般用于主视图中已经存在了这 ...

  4. 05_传智播客iOS视频教程_第一个OC程序

    Cocoa Application开发的是带界面的程序. OC是完全兼容C语言的,但是C语言里面是不能写OC的东西的. OC和C的第一个区别,就是源文件的后缀名的区别.OC程序的源文件的后缀名是.m, ...

  5. bzoj 2839: 集合计数【容斥原理+组合数学】

    首先,考虑容斥,我们所要的答案是并集至少有\( k \)个数的方案数减去并集至少有\( k+1 \)个数的方案数加上并集至少有\( k \)个数的方案数-- 在n个数中选i个的方案数是\( C_{n} ...

  6. bzoj 2754: [SCOI2012]喵星球上的点名【AC自动机】

    洛谷90,最后一个点死活卡不过去(也可能是我写的有问题? 比较暴力的做法,把询问带着标号建立AC自动机,用map存儿子. 然后用名字串在自动机上跑,以为是名或姓的子串就行所以把名和姓中间加个特殊字符拼 ...

  7. DevStack部署OpenStack开发环境 - 问题总结

    建议在使用DevStack搭建OpenStack开发环境前,先安装好开发工具包组.特别是gcc,主要一定是在yum update -y 之前,否则更新完系统后,在安装开发工具包会出现很多依赖包因为版本 ...

  8. 在代码里更新autolayout布局

    //遍历view约束(高,宽) NSArray* constrains = self.View.constraints; for (NSLayoutConstraint* constraint in ...

  9. iOS 应用打包 设备兼容性问题(Build Active Architecture Only)

    在把应用打包安装到iPod Touch上面时,设备提示不兼容,所以就有几种猜想: 1.CPU架构问题,因为我手里这个iPod Touch的CPU是A5,是32位的: 2.TARGETS里面相关的设置对 ...

  10. not and or

    not and or (逻辑表达式) 首先要做一些准备知识: 1,优先级:逻辑型 < 测试型 < 关系型 < 算数型 2,逻辑型优先级:or < and < not 3, ...