zoukankan      html  css  js  c++  java
  • 将Jar安装到本地仓库和Jar上传到私服

    举例

    1. 依赖如下:

    [html] view plain copy
     
     print?
    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包安装到本地仓库命令:

    [html] view plain copy
     
     print?
    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到私服  

    命令:

    [html] view plain copy
     
     print?
    1. mvn deploy:deploy-file -DgroupId=org.terracotta.toolkit -DartifactId=terracotta-toolkit-api-internal -Dversion=1.12 -Dpackaging=jar -Dfile=D: erracotta-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: estcom.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: estcom.exmyth.gprinter.jar -Dpackaging=jar -DgeneratePom=true -DlocalRepositoryPath=D: estmvn -DcreateChecksum=true 

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

    本地

    D:	estmvn>mvn install:install-file  -Dfile=D:	estcom.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) 1
    [INFO] ------------------------------------------------------------------------
    [INFO]
    [INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom
    ---
    [INFO] Installing D:	estcom.exmyth.gprinter.jar to D:
    epositorycomexmythgp
    rinter1.0gprinter-1.0.jar
    [INFO] Installing C:UsersWPWLAppDataLocalTempmvninstall8371599131162576038
    .pom to D:
    epositorycomexmythgprinter1.0gprinter-1.0.pom
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 0.528 s
    [INFO] Finished at: 2016-07-21T13:57:47+08:00
    [INFO] Final Memory: 7M/123M
    [INFO] ------------------------------------------------------------------------

    私服

    D:	estmvn>mvn deploy:deploy-file -DgroupId=com.exmyth -DartifactId=gprinter -D
    version=1.0 -Dpackaging=jar -Dfile=D:	estcom.exmyth.gprinter.jar -Durl=http://
    192.168.199.182:9091/nexus/content/repositories/thirdparty/ -DrepositoryId=third
    party
    [INFO] Scanning for projects...
    [INFO]
    [INFO] ------------------------------------------------------------------------
    [INFO] Building Maven Stub Project (No POM) 1
    [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: 2016-07-21T14:14:35+08:00
    [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: 401, ReasonPhrase: Unauth
    orized. -> [Help 1]
    [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 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
    xception
    
    D:	estmvn>
  • 相关阅读:
    hadoop再次集群搭建(3)-如何选择相应的hadoop版本
    48. Rotate Image
    352. Data Stream as Disjoint Interval
    163. Missing Ranges
    228. Summary Ranges
    147. Insertion Sort List
    324. Wiggle Sort II
    215. Kth Largest Element in an Array
    快速排序
    280. Wiggle Sort
  • 原文地址:https://www.cnblogs.com/exmyth/p/5693067.html
Copyright © 2011-2022 走看看