英文:
Why is Coursier needed? What is the different between coursier and maven, sbt, gradle?
问题
文档表示Coursier是Scala的新型构件管理器。但Coursier与Maven、SBT和Gradle等构建工具有什么区别呢?为什么我需要一个带有jar文件的“+1”文件夹?我已经有了用于Maven存储库的“.m2”文件夹,Gradle的“.gradle”文件夹,以及SBT的“.sbt”文件夹。所以我构建了一些项目,现在我有了“AppData/Local/Coursier”文件夹,里面有“相同”的jar文件。有人能解释一下“Coursier”项目的目标是什么吗?
英文:
The documentation says that coursier is a new artifact manager for scala. But what is the difference between Coursier and build tools like maven, sbt and gradle? Why do I need +1
folder with jar files? I have already .m2
for maven repository, .gradle
for gradle, and .sbt
for sbt. So I built some project and now I have AppData/Local/Coursier
with "same" jar files. Could somebody explain what is the goal for Coursier
project?
答案1
得分: 5
你正在混淆构建工具如 sbt 和 Maven 以及 Gradle 和 Ant,与构件管理器如 coursier 和 ivy。
据我所知(请纠正我如果我错了),在 coursier 被发明之前,sbt 使用 ivy 从像 MavenCentral 这样的存储库下载 JAR 文件。<br>
之后,coursier 被发明出来,以更快地处理 Scala 依赖项(包括版本后缀等)。我不太清楚技术上的差异是什么,但我真的不关心,因为这是一个实现细节。<br>
然后,较新版本的 sbt 简单地从使用 ivy 切换到使用 coursier,最大的区别是现在下载速度更快,缓存文件夹也发生了变化。
随着时间的推移,在 coursier 这个基本构件管理器之上,还构建了其他东西,比如 cs
工具、scala-cli
、GithubActions 的共享操作,如 coursier/setup-scala
和 coursier/cache
。
因此,截止到今天,一切都能无缝协同工作。
关于重复的 JAR 文件夹。
除非你同时使用 sbt 和 maven,并且它们之间有共享的依赖项,否则你应该能够只删除旧的 .m2
文件夹。
英文:
You are confusing a build tool like sbt and Maven and Gradle and Ant, with an artifact manager like coursier and ivy.
AFAIK (please correct me if wrong), before coursier was invented, sbt used ivy to download the JAR files from repositories like MavenCentral.<br>
After that, coursier was invented to be both faster and better handle Scala dependencies (the versions suffixes and all that). I am not really sure what are the technical differences, but I really don't care since it is an implementation detail.<br>
Then, newer versions of sbt simply switched from using ivy to use coursier, and the biggest difference was that it was now faster at downloading things, and that the cache folder changed.
With time, over the coursier bare artifact manager, other things have been built like the cs
tool, scala-cli
, the GithubActions shared actions like coursier/setup-scala
& coursier/cache
.
Thus, as of today, everything works together seamlessly.
About the duplicated JAR's folders.
Unless you are using both sbt and maven with shared dependencies between both, you should be able to just delete the old .m2
folder.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论