举例

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. java对象序列化的理解

    1.java中的序列化时transient变量(这个关键字的作用就是告知JAVA我不可以被序列化)和静态变量不会被序列          化(下面是一个测试的例子) (实体带versionUUID,便 ...

  2. bzoj 4571 美味 —— 主席树

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=4571 区间找异或值最大,还带加法,可以用主席树: 可以按位考虑,然后通过加上之前已经有的答案 ...

  3. Integer和int的区别(转)

    public class TestInteger { public static void main(String[] args) { int i = 128; Integer i2 = 128; I ...

  4. 【黑金教程笔记之005】【建模篇】【Lab 04 消抖模块之二】—笔记

    实验四和实验三的区别在于输出.实验三是检测到由高到低的电平变化时就拉高输出,检测到由低到高的电平变化时就拉低输出.而实验四检测到由高到低的电平变化时产生一个100ms的高脉冲.当检测到由低到高的电平变 ...

  5. Ubuntu adb devices :???????????? no permissions 解决方法[转]

    转自: http://www.cnblogs.com/cat-lee/archive/2011/07/09/2101718.html untun下USB连接Android手机后,使用adb devic ...

  6. bzoj 2115: [Wc2011] Xor【线性基+dfs】

    -老是想到最长路上 其实可以这样:把每个环的xor和都存起来,然后任选一条1到n的路径的xor和ans,答案就是这个ans在环的线性基上跑贪心. 为什么是对的--因为可以重边而且是无相连通的,并且对于 ...

  7. head first python /chapter7 web(python 3 转 python 2.7)

    前言 书中使用的是python3,我这里使用的是python2.7 Web 的目录树 webapp/ ├── cgi-bin │ ├── athletelist.py │ ├── athletemod ...

  8. 官方XmlPullParser和网络解析xml示例及详述

    Parsing XML Data This lesson teaches you to Choose a Parser Analyze the Feed Instantiate the Parser ...

  9. C. Dasha and Password 预处理 + dp

    http://codeforces.com/contest/761/problem/C 对于每一个字符串,可以预处理出其到达数字,字母,和特殊符号所需的最小步数. 然后就是在n个东西中,选出数字.字母 ...

  10. 枚举Enum通过int值或文本转为对应的枚举类型

    1.数值转枚举 如果枚举类型继承了数值类型,可以直接强制转换 public enum SourceType : byte { YC = , TS = , QK = , ZQ = } //转换方式 ; ...