2

I'm trying to migrate my build packages from our on-premise Nexus Repository Manager to Azure Artifacts. I have found this Microsoft link explaining how to do it for NuGet (a .NET package manager) with a Powershell script, but there is no such tool for Maven.

I was thinking about retrieving all the build files with a "maven clean compile" and then pointing my pom.xml file to Azure Artifacts and then somehow push them. However, the amount of packages run into the 100k and there are many applications using it. So this feels like a very clunky way of going about it that will take a lot of effort and a lot of room for error.

Does anyone have any advice for me?

Herman
  • 750
  • 1
  • 10
  • 23
  • Even running the build locally and then directing it to Artifacts doesn't work because the build fails because it can't find a parent-pom that it needs at Azure Artifacts. It is stored locally, but I can't get it to search there. – Herman Jan 28 '20 at 14:31
  • 1
    Looks like you want to use Azure Artifacts to host maven packages, check if [it](https://learn.microsoft.com/en-us/azure/devops/artifacts/get-started-maven?view=azure-devops) is what you need. – LoLance Jan 29 '20 at 08:35
  • Hey @LanceLi-MSFT, I'm still getting the "Could not resolve dependencies for project" error because it's trying to get certain packages from Azure Artifacts, which is still completely empty. Can I somehow push the local artifacts to Azure Artifacts? – Herman Jan 29 '20 at 13:06
  • In which step/task do you get that error? Could you share some details about your build pipeline so that I can reproduce that issue and check for you:) – LoLance Jan 30 '20 at 12:28

1 Answers1

0

It turns out my issue mainly caused by my limited understanding of Artifact repos and the dependency chain of the project. Apparently it Artifact repos do caching of all the upstream repos so that's why there where 100k files in there. In the end there were only two company specific dependencies that needed moving.

I accomplished the migration following way (applicable for to all Maven migrations):

Clone the highest dependencies in the chain. (probably contains a name with commons or parent)

Add Azure Artifacts configuration to ${USER_HOME}/.m2/settings.xml and pom.xml as described here: https://robeco.visualstudio.com/Delivery%20Integration%20Services/_packaging?_a=connect&feed=Maven-feed

Retrieve dependencies from current repo

mvn install
mvn package

Create a release version (without -SNAPSHOT behind it) and push it to Azure Artifacts (else you'll get a Can't release project due to non released dependencies error)

mvn release:clean
mvn release:prepare
mvn release:perform

Now you have something like a robeco-common-version1.0.16 build. Now deploy it to Azure Artifacts

mvn deploy

You should see something like Uploading to Maven-feed: https://robeco.pkgs.visualstudio.com/....

Do the same steps for all subsequent company specific dependencies.

Herman
  • 750
  • 1
  • 10
  • 23