Maven上传第三方jar包

Maven上传第三方jar包

%MAVEN_HOME%\conf\settings.xml 中配置服务登录信息,后面上传的时候会引用到这里的id

  <servers>
   <server>
        <id>maven-releasesid>
        <username>adminusername>
        <password>admin123password>
   server>
  servers>

命令行上传

mvn deploy:deploy-file -DgroupId=com.tairan.qa -DartifactId=reportng -Dversion=1.1.5 -Dpackaging=jar -Dfile=E:\Tmp\reportng-1.1.5.jar -Durl=http://localhost:8081/repository/maven-releases/ -DrepositoryId=maven-releases

注意:jar包上传路径Dfile不能位于本地仓库,否则会报如下错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file (default-cli) on project standalone-pom: Cannot deploy artifact from the local repository: E:\workspace\maven\localrepo\com\tairan\qa\reportng\1.1.5\reportng-1.1.5.jar -> [Help 1]

通过pom.xml上传
配置项目构件发布信息,id为setting.xml中配置的server的id:

  <distributionManagement>
    <repository> 
      <id>maven-releasesid> 
      <name>MavenReleasesname> 
      <url>http://localhost:8081/repository/maven-releases/url> 
    repository>

    
  distributionManagement>

你可能感兴趣的:(back-end,Maven)