I need an older version of Apache Commons Lang3 in Azure Artifacts. I need version 3.8.1 (last version that supports Java 7) but it's not listed. Is there a way to get Azure Artifacts to grab a specific version from Maven Central?
I need an older version of Apache Commons Lang3 in Azure Artifacts. I need version 3.8.1 (last version that supports Java 7) but it's not listed. Is there a way to get Azure Artifacts to grab a specific version from Maven Central?
Since the package is public, you just need at least one time to use, and then the package version will be listed in the artifact feed.
It is successfully to get the specific version package on my side:
How I achieve that:
POM.xml on my side:
<?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>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>111</version>
<name>demo</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<repositories>
<repository>
<id>BowmanCP</id>
<url>https://pkgs.dev.azure.com/BowmanCP/_packaging/BowmanCP/maven/v1</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>BowmanCP</id>
<url>https://pkgs.dev.azure.com/BowmanCP/_packaging/BowmanCP/maven/v1</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</distributionManagement>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
</dependency>
</dependencies>
<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
The key is 3 part:
1, repositories part
<repositories>
<repository>
<id>BowmanCP</id>
<url>https://pkgs.dev.azure.com/BowmanCP/_packaging/BowmanCP/maven/v1</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
2, distributionManagement part
<distributionManagement>
<repository>
<id>BowmanCP</id>
<url>https://pkgs.dev.azure.com/BowmanCP/_packaging/BowmanCP/maven/v1</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</distributionManagement>
3, dependencies part
<dependencies>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
</dependency>
</dependencies>
The previous 2 part comes from this place:
Push this Maven project to a repo in Azure DevOps, and then use below yml to install the package:
trigger:
- none
pool:
vmImage: ubuntu-latest
steps:
- task: MavenAuthenticate@0 # This step is changing the setting.xml in agent account.
inputs:
artifactsFeeds: 'BowmanCP'
- task: Maven@3 #This step will install the specific maven package mentioned in POM.xml,
inputs:
mavenPomFile: 'demo/pom.xml'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.8'
mavenVersionOption: 'Default'
mavenOptions: '-Xmx3072m'
mavenAuthenticateFeed: true
effectivePomSkip: false
sonarQubeRunAnalysis: false
This is my repo structure:
You can refer to this official document:
https://docs.microsoft.com/en-us/azure/devops/artifacts/maven/upstream-sources?view=azure-devops