Submit Maven dependencies (mvn deploy-file) in the Azure DevOps Server

Contents

1. Overview
2. necessary preparations
to install the Java
download and install Maven
3. Server Configuration
New Connection source
4. Client Configuration
5. Upload maven package files
6. FAQs
Maven 3.6.2, the latest version of abnormal

1 Overview

Azure DevOps Server (TFS) dependencies can achieve a variety of hosting server, e.g. NuGet, NPM, Maven, Python, Gradle, Azure General Packet like. Maven repository which is most familiar to many Java developers a library, Azure DevOps Server provides a similar Maven PW (eg Nexus) of insurance management services. Developers can get from Azure DevOps Server systems rely on third-party software packages, you can also publish their own to develop a common software packages on Azure DevOps server, share it with other development teams.

Maven package management Azure DevOps in, follow the standard Maven package management protocol, developers can use any standard maven tools for uploading and downloading dependencies. More common dependencies management in two ways: automatically publish package files in compilation flow; the files from using maven plug-deploy-file that already exists on the server.

If you need to know about publishing maven package compilation flow, you can refer Azure DevOps Server ;

This article describes how to use maven plug-deploy-file will release the package file that already exists on the server.

2. necessary preparations

  • Install Java

In this article, we use the 64-bit java, 1.8.0

C:\apache-maven-3.6.2\bin>java -version java version "1.8.0_161" Java(TM) SE Runtime Environment (build 1.8.0_161-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)


  • Download and install Maven

In this article, we use the Maven version 3.6.0, the most current version 3.6.2 abnormal, refer to the FAQs later described.

3. Server Configuration

New Connection source

image

Configuration name and permissions

image

Maven generated authentication information

image

image

Copy Maven authentication information generated in the server, and configure it to the local computer Maven profile in settings.xml

image

4. Client configuration

Maven text editor open configuration file on the local computer, and paste the generated authentication information to the above document nodes Servers

image

5. Upload file maven package

First we need to prepare Maven package files that already exist, such as the following operations, we use to download files from the Internet package ckfinder.jar
we write good following command line script

mvn deploy:deploy-file -DgroupId=com.ckfinder -DartifactId=ckfinder -Dversion=2.6 -Dpackaging=jar -DrepositoryId=tfs-net-com-cn-collection-c-maven -Dfile=D:\temp\ckfinder.jar -Durl=http://tfs.net.com.cn:8080/tfs/Collection/_packaging/maven/maven/v1

We need some explanation of several key parameters above:
  • repositoryId: local Maven configuration file server node name, the name of the server authentication information is obtained from the above section in the Azure DevOps server; Maven will query the name in accordance with the authentication information, submitted to the server
  • file: dependent on the local computer store the full path of the file package
  • url: Azure DevOps Server in the Maven repository server address

If you need more parameters, please refer maven official document:

6. Frequently Asked Questions

The latest version of Maven 3.6.2 appear abnormal

C:\apache-maven-3.6.2\bin>mvn deploy:deploy-file -DgroupId=com.ckfinder -DartifactId=ckfinder -Dversion=2.6 -Dpackaging=jar -DrepositoryId=tfs-mc-net-智能软件公司-zhanghongjun -Dfile=D:\temp\htmlparser.jar -Durl=http://tfs.mc.net:8080/tfs/智能软件公司/_packaging/zhanghongjun/maven/v1 [INFO] Scanning for projects... [INFO] [INFO] ------------------< org.apache.maven:standalone-pom >------------------- [INFO] Building Maven Stub Project (No POM) 1 [INFO] --------------------------------[ pom ]--------------------------------- [INFO] [INFO] --- maven-deploy-plugin:2.7:deploy-file (default-cli) @ standalone-pom --- Uploading to tfs-mc-net-智能软件公司-zhanghongjun: http://tfs.mc.net:8080/tfs/智能软件公司/_packaging/zhanghongjun/maven/v1/com/ckfinder/ckfinder/2.6/ckfinder-2.6.jar Uploading to tfs-mc-net-智能软件公司-zhanghongjun: http://tfs.mc.net:8080/tfs/智能软件公司/_packaging/zhanghongjun/maven/v1/com/ckfinder/ckfinder/2.6/ckfinder-2.6.pom [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.018 s [INFO] Finished at: 2019-09-26T17:28:41+08:00 [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.ckfinder:ckfinder:jar:2.6 from/to tfs-mc-net-智能软件公司-zhanghongjun (http://tfs.mc.net:8080/tfs/智能软件公司/_packaging/zhanghongjun/maven/v1): Failed to transfer file http://tfs.mc.net:8080/tfs/智能软件公司/_packaging/zhanghongjun/maven/v1/com/ckfinder/ckfinder/2.6/ckfinder-2.6.jar with status code 400 -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [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 read the following articles: [ERROR] [Help 1] http://cwiki.a

------------------------------------------------------------

http://www.cnblogs.com/danzhang/   DevOps MVP Zhang Hongjun

------------------------------------------------------------

Guess you like

Origin www.cnblogs.com/danzhang/p/11593771.html