lpacheco
lpacheco

Reputation: 1026

Maven uses different repos in Azure Pipelines than local

I have a project that fails mvn package in Azure Pipelines even if the same branch builds successfully locally. The issue is a missing dependency.

Locally, Maven downloads the dependency from

In Azure Pipelines it tries to download the dependency from

The dependency is org.mule.connectors:mule-soap-engine:jar:1.6.11, which does exist in Mulesoft Nexus EE repository, used locally, but doesn't exist in the public repositories used in Azure DevOps.

Both builds are using the same pom.xml (same reflog). Since Mulesoft Nexus EE is a private repository, I have credentials configured in my local settings.xml and I use MavenAuthenticate@0 to refer to the service connections in Azure Pipelines. MavenAuthenticate@0 seems to be working.

##[debug]mavenServiceConnections=4ff28bb5-a556-4220-9260-a1d89c8c7c6b
##[debug]4ff28bb5-a556-4220-9260-a1d89c8c7c6b=https://repository.mulesoft.org/nexus-ee/content/repositories/releases-ee/
##[debug]4ff28bb5-a556-4220-9260-a1d89c8c7c6b exists true
##[debug]4ff28bb5-a556-4220-9260-a1d89c8c7c6b auth scheme = UsernamePassword
##[debug]4ff28bb5-a556-4220-9260-a1d89c8c7c6b data REPOSITORYID = MuleRepository
##[debug]Found username/password service connection for package source https://repository.mulesoft.org/nexus-ee/content/repositories/releases-ee/
##[debug]Generating configs for 1 external repositories.
##[debug]Detected username/password credentials for 'https://repository.mulesoft.org/nexus-ee/content/repositories/releases-ee/'
##[debug]Agent.Version=3.220.5
##[debug]set task variable: userM2SettingsXmlPath=/home/vsts/.m2/settings.xml
##[debug]Processed: ##vso[task.settaskvariable variable=userM2SettingsXmlPath;issecret=false;]/home/vsts/.m2/settings.xml
##[debug]Adding authentication to settings file /home/vsts/.m2/settings.xml.
##[debug]Agent.Version=3.220.5
##[debug]set task variable: backupUserM2SettingsFilePath=/home/vsts/.m2/_settings.xml
##[debug]Processed: ##vso[task.settaskvariable variable=backupUserM2SettingsFilePath;issecret=false;]/home/vsts/.m2/_settings.xml
##[debug]Writing new settings.xml with added authentication.

What I don't get is why Maven in Azure Pipelines is trying in different repositories, that aren't even mentioned in the pom.xml or MavenAuthenticate@0. I'm out of ideas on how to debug this.

Upvotes: 0

Views: 310

Answers (1)

aled
aled

Reputation: 25699

When Maven can not find a dependency it will try to download it from other repositories in the build, because it doesn't know which one is the right one, if any. It also will try repositories in transitive dependencies poms.

Repositories that start with https://repository-master.mulesoft.org/ are not intended to be used by outside MuleSoft and should not be used in your projects. If it is in a transitive dependency you don't have control over that.

You are not sharing enough information to further troubleshoot the issue. If it is working locally maybe you have additional credentials in the settings.xml of the local build that allow it to access additional repositories, and those credentials are missing in the Azure build.

Upvotes: 0

Related Questions