Reputation: 1
Maven build task -> There are few dependencies that are put in private repository. While running CI pipeline it is unable to connect to that private repo. to download the dependency and proceed.
Upvotes: 0
Views: 2406
Reputation: 30343
If the private maven repository is hosted on a local server. You need to create a self-hosted agent on the local machine which has access to the private repository.
And you need to create a maven service connection in your azure devops project (Project settings-->Service connections under Pipelines-->New service connection-->select Maven).
Then you need to run your pipeline on your self-hosted agent(Choose the agent pool where your self-hosted agent resides), for the microsoft hosted agents cannot access to the private repository hosted on your local server. And add Maven Authenticate task to authenticate your private repository during the build. Select the maven service connection created in above step in field Credentials for repositories outside this organization/collection
(also mavenServiceConnections
in yaml format pipeline)
You can also put those dependencies in azure artifact feed. Please check this quick start to create a maven feed in your azure devops and publish your dependencies to it. And follow the instructions to set up your project by adding the repo to your pom.xml file.
Then you need to set the mavenFeedAuthenticate
argument to true
in your Maven task. (In Advanced
settings of Classic UI task). Now you should be able to download the dependencies published to the azure artifacts feed in your pipeline.
However, another way to authenticate your feed is to use Maven Authenticate task
. See below: Select your maven feed to authenticate in the pipeline.
If you want to consume the maven repositories outside current organization. You need to follow above steps of creating a maven service connection for this repository.
Upvotes: 1