I'm using an Azure DevOps YAML build pipeline to compile some java code. The java code uses azure-storage-blob
I can install a bunch of maven jar's but azure-storage-blob returns "Could not find artifact". I notice that it's path is https://repo1.maven.org
, not https://repo.maven.org
Among other things I have this in my pom.xml:
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-security-keyvault-secrets</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-storage-blob</artifactId>
<version>12.14.0</version>
</dependency>
part of maven output looks like this:
Downloaded from central: https://repo.maven.apache.org/maven2/com/microsoft/azure/azure-keyvault-core/1.0.0/azure-keyvault-core-1.0.0.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/slf4j/slf4j-nop/1.7.21/slf4j-nop-1.7.21.jar (4.0 kB at 660 B/s)
Downloaded from central: https://repo.maven.apache.org/maven2/com/google/guava/guava/20.0/guava-20.0.jar (2.4 MB at 399 kB/s)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:53 min
[INFO] Finished at: 2021-11-26T12:22:10Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project XYZ: Could not resolve dependencies for project com.function:Decryption_POC_JAVA:jar:1.0-SNAPSHOT: Could not find artifact com.azure:azure-storage-blob:jar:12.4.0 in central (https://repo.maven.apache.org/maven2) -> [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.apache.org/confluence/display/MAVEN/DependencyResolutionException
The process '/usr/bin/mvn' failed with exit code 1
Could not retrieve code analysis results - Maven run failed.
So it can successfully download a whole bunch of jars from https://repo.maven.apache.org/maven2/com/microsoft/azure/
But it can't download just the blob jar in particular
What I have discovered is that this file doesn't exist:
https://repo.maven.org/maven2/com/azure/azure-storage-blob/12.14.0/azure-storage-blob-12.14.0.jar
(I assume this is where it's looking, but I can't get it to display it)
However this file does:
https://repo1.maven.org/maven2/com/azure/azure-storage-blob/12.14.0/azure-storage-blob-12.14.0.jar
Note this is repo1 not repo. I only found this because this Maven page specified it.
So I tried to force to look at repo1 by adding this to pom.xml
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central1</id>
<name>Maven Repository Switchboard</name>
<url>http://repo1.maven.org/maven2</url>
</repository>
</repositories>
The error changes to
Failed to collect dependencies at com.azure:azure-storage-blob:jar:12.4.0: Failed to read artifact descriptor for com.azure:azure-storage-blob:jar:12.4.0: Could not transfer artifact com.azure:azure-storage-blob:pom:12.4.0 from/to maven-default-http-blocker (http://0.0.0.0/): Blocked mirror for repositories: [central1 (http://repo1.maven.org/maven2, default
My questions are:
Note that I'm using Azure DevOps and I don't have a lot of maven experience so I'm not sure if I can clear caches or clear local maven repos or anything like that. Also this an existing setup that I'm trying to get working.
Here's the parts of the YAML that matter:
trigger:
paths:
include:
- "src/*"
- "pom.xml"
stages:
- stage: Build
jobs:
- job: mavenBuild
pool:
vmImage: 'ubuntu-latest'
steps:
- task: Maven@3
inputs:
mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.8'
jdkArchitectureOption: 'x64'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
goals: 'package'
I found this issue in Azure Pipeline Could not find artifact com.azure:azure-storage-blob:jar:12.4.0
too.
I found something interesting from this maven link that is Jar (474KB)
link has broken. So I changed com.azure:azure-storage-blob:jar
version to the latest version 12.14.2
.
it's work. Azure Pipelines can download this artifact from Maven Central Repo.