scalacenter / scala3-migrate

A tool to help migrating from Scala 2 to Scala 3
https://docs.scala-lang.org/scala3/guides/migration/scala3-migrate.html
Apache License 2.0
110 stars 24 forks source link

Use configured repositories from the sbt build #484

Closed mblund closed 3 months ago

mblund commented 3 months ago

The scala3 migration plugin gave a false suggestion for how to migrate Akka libraries. Instead of saying that the latest 2.9.4 version was a valid scala 3 library it suggested to downgrade to a version as early as 2.6.18 up to the version 2.9.0-M2. These version are the ones that are published to the maven central that this plugin are hard coded to. Later version of akka are published to https://repo.akka.io/maven.

This patch is using the configured repository in the sbt build to resolve the dependencies and are thereby able to find the correct versions.

Now:

sbt:test-project>  migrateDependencies test-project
[info]
[info] Starting migration of libraries and compiler plugins in project 'test-project'
[info]
[info] Valid dependencies:
...
[info] "com.typesafe.akka" %% "akka-cluster-typed" % "2.9.4"
...

Before this commit, older akka versions published to maven central was suggested by the migration tool

[warn] Versions to update:
...
[warn] "com.typesafe.akka" %% "akka-cluster-typed" % "2.6.17" (Other versions: 2.6.18, ..., 2.9.0-M2)
...

Will close #95

adpi2 commented 3 months ago

Thanks @mblund for the pull request. I am going to review this soon.

mblund commented 3 months ago

@adpi2 Have you had time to take a look at this PR?

adpi2 commented 3 months ago

Hey @mblund. It took a bit of time because I was in vacation.

This is a good improvement but it only works for Maven repositories and it does not support authentication. I opened #488 to address those issues on top of your changes. And so it supersedes this PR.

mblund commented 3 months ago

Okay, great! I'm happy to have been able to make progress on this.