Wednesday, 9 October 2019

azure devops how, to make your pipeline be able to download your private jar file from your private maven repo


if you have a jar file on a private maven repo. and you want to enable your azure devops pipeline be able to access it. then you can :


first, Azure devops can also be used as a private maven repo. see below link for detail:


Usually private maven repo ask you to put the access username and password into the settings.xml into your local .m2 folder.

you need to do the same thing to your pipeline, because your pipeline will be run on a vbox, it is just a computer.

The way to do that is:

1. add it into pipleline securefile





2,  add below task into your pipeline:



# Download settings.xml which can help in connecting to Azure feed
- task: DownloadSecureFile@1
displayName: Get settings.xml
inputs:
secureFile: 'settings.xml'

# Copy files to maven home
- task: CopyFiles@2
displayName: Copy settings.xml to mvn home
inputs:
SourceFolder: '$(Agent.TempDirectory)'
Contents: 'settings.xml'
TargetFolder: '/home/vsts/.m2/'

run it and then you will see below error , then just authroise it.


you will be fine, just re-run




another way:
you can just you service connection: (i didn't validate this.)





No comments:

Post a comment