I have a parent pom where I have used maven-release-plugin, with the artifact that needs to be pushed to Azure artifacts. I was able to make it work on my local, and now am trying to automate it using azure pipeline, but I get the below error for the mvn release:perform
.
Error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:3.0.0-M1:perform (default-cli) on project my-parent-repo: Unable to checkout from SCM
[ERROR] Provider message:
[ERROR] The git-clone command failed.
[ERROR] Command output:
[ERROR] Cloning into 'checkout'...
[ERROR] fatal: could not read Password for 'https:********@dev.azure.com': terminal prompts disabled
[ERROR] -> [Help 1]
My pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<scm>
<developerConnection>scm:git:https://$(PAT)@dev.azure.com/my-org/my-prjt/_git/my-parent-repo/</developerConnection>
<tag>HEAD</tag>
</scm>
<groupId>dispute</groupId>
<artifactId>my-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Microservice DI parent</name>
<description>DI microservice parent </description>
<distributionManagement>
<!-- Publish the versioned releases here -->
<repository>
<id>repo</id>
<name>Artifact repo</name>
<url>https://xxx.pkgs.visualstudio.com/2abc/_packaging/my-maven-artifacts/maven/v1</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>3.0.0-M1</version>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>my-maven-artifacts</id>
<url>
https://xxx.pkgs.visualstudio.com/2abc/_packaging/my-maven-artifacts/maven/v1
</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>Pod4-artifacts</id>
<url>
https://xxx.pkgs.visualstudio.com/2abc/_packaging/my-maven-artifacts/maven/v1
</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<properties>
<!-- Build properties -->
<maven.version>3.3.9</maven.version>
<java.version>11</java.version>
</properties>
</project>
Fixes tried:
I have enabled Allow scripts to access the OAuth token
on the Agent job. I have also provided the permissions for the Project Collection Service Accounts and Project Collection Build Service to create tag, branch, contribute under Repositories.
Also, have a ci-settings.xml with the username and password for the repo id, which am providing as arguments in the Maven task in the Azure pipeline.
-e -B -s $(System.DefaultWorkingDirectory)/ci-settings.xml
If there is anything am missing, please let me know. Please note, it worked perfectly in my local.