Open mheese opened 10 years ago
You can easily do it by adding plugin to the "meta"-project so to say. For example, to add it globally, put in ~/.sbt/0.13/plugins/project/plugins.sbt
the line
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.1.2")
Now in any project you can do (in sbt):
> reload plugins
> dependencyUpdates
then use reload return
to return to the project.
Moreover, you can make an alias for that. Add to your ~/.sbt/0.13/global.sbt
:
addCommandAlias("pluginUpdates", "; reload plugins; dependencyUpdates; reload return")
Awesome! Works like a charm! In my opinion this hint deserves a place in the README.md of this project.
Nice trick, @laughedelic, thanks. I'm reopening the issue because it was in my plans to add a native task for plugin updates.
:+1:
:+1:
+1
+1 for easier native method, e.g. pluginDependencyUpdates
+1 for pluginUpdates
:+1:
+1 for native pluginUpdates
+1
+1 for native pluginUpdates
:+1: The above trick works so there is no hurry, but I think it would still be valuable addition
@rtimush I tried the above trick, but can't get it to work:
$ reload plugins
[info] Loading global plugins from /Users/XXX/dotfiles/scala/.sbt/0.13/plugins/project
[info] Loading global plugins from /Users/XXX/dotfiles/scala/.sbt/0.13/plugins
[info] Loading project definition from /Users/XXX/Developer/YYY/project
> dependencyUpdates
[info] Found 5 dependency updates for project
[info] org.scala-lang:scala-compiler:ensime-internal : 2.10.6 -> 2.11.8
[info] org.scala-lang:scala-library:ensime-internal : 2.10.6 -> 2.11.8
[info] org.scala-lang:scala-library:provided : 2.10.6 -> 2.11.8
[info] org.scala-lang:scala-reflect:ensime-internal : 2.10.6 -> 2.11.8
[info] org.scala-lang:scalap:ensime-internal : 2.10.6 -> 2.11.8
dependencyUpdates
includes updates for the Scala version, but not about outdated plugins, even though I deliberately downgraded a couple of plugins, both in my global plugins.sbt
and in the plugins.sbt
of the project.
Same:
> reload plugins
[info] Loading global plugins from /home/aromanov/.sbt/0.13/plugins
[info] Updating {file:/home/aromanov/.sbt/0.13/plugins/}global-plugins...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Loading project definition from /home/aromanov/IdeaProjects/scalan-lite-1/project
> show libraryDependencies
[info] List(org.scala-lang:scala-library:2.10.5:provided, com.eed3si9n:sbt-assembly:0.13.0 (e:sbtVersion=0.13, e:scalaVersion=2.10), com.github.gseitz:sbt-release:1.0.0 (e:sbtVersion=0.13, e:scalaVersion=2.10))
> dependencyUpdates
[info] Found 1 dependency update for project
[info] org.scala-lang:scala-library:provided : 2.10.5 -> 2.10.6 -> 2.11.8
But current sbt-assembly
version is 0.14.3 and sbt-release
is 1.0.3.
I'm seeing the same issue as @lunaryorn and @alexeyr.
The issue persists and @laughedelic's workaround doesn't work anymore, as people are saying. Is there another workaround that works? If not, is this feature scheduled for anytime soon?
Nevermind what I said, I updated sbt-updates to version 0.3.0 and the workaround seems to have started working again :)
workaround doesn't work for me:
> reload plugins
[info] Loading project definition from /Users/dmitry/Projects/events/project
> show libraryDependencies
[info] * org.scala-lang:scala-library:2.10.6:provided
[info] * io.get-coursier:sbt-coursier:1.0.0-M15-1 (e:sbtVersion=0.13, e:scalaVersion=2.10)
[info] * org.ensime:sbt-ensime:1.12.6 (e:sbtVersion=0.13, e:scalaVersion=2.10)
[info] * io.spray:sbt-revolver:0.8.0 (e:sbtVersion=0.13, e:scalaVersion=2.10)
[info] * com.geirsson:sbt-scalafmt:0.5.6 (e:sbtVersion=0.13, e:scalaVersion=2.10)
[info] * org.scalastyle:scalastyle-sbt-plugin:0.8.0 (e:sbtVersion=0.13, e:scalaVersion=2.10)
[info] * com.timushev.sbt:sbt-updates:0.3.0 (e:sbtVersion=0.13, e:scalaVersion=2.10)
> dependencyUpdates
[error] Not a valid command: dependencyUpdates
[error] Not a valid key: dependencyUpdates (similar: dependencyClasspath, dependencyOverrides, dependency-overrides)
[error] dependencyUpdates
[error] ^
>
Am I missing something in sbt-updates setup?
@slothspot did you setup sbt-updates just for the project or in the global sbt configuration file? In order to get dependency updates for sbt plugins you need to have sbt-updates configured globally.
Oh, thanks for explanation. I prefer per-project plugins setup. May be it would be reasonable to add note about this in README?
Yes, it is worth mentioning in the README. Regarding a per-project setup — I suppose if you add sbt-updates as a plugin to your build project (addSbtPlugin
in project/project/sbt-updates.sbt
) then it will work for plugin updates.
In case of putting sbt-updates.sbt
into project/project
dependencyUpdates
is not available for project itself, and placing sbt-updates.sbt
twice inside of the project is not very convenient.
This is why it's called a workaround, not a solution. Again... Problem: include updates for plugins. Workaround: plugins are just dependencies of the meta build, so use sbt-updates on the meta build.
Regardless, I would recommend setting it up globally. After all, you don't want CI or other machines to have to download it, but you do want to use it for any project on your machine (there's nothing about one project that makes sbt-native-packager updates more useful than the next project). Hence its usefulness is per machine (well, user...) not project.
On Sat, Feb 18, 2017, 7:39 AM Dmitry Melnichenko notifications@github.com wrote:
In case of putting sbt-updates.sbt into project/project dependencyUpdates is not available for project itself, and placing sbt-updates.sbt twice inside of the project is not very convenient.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rtimush/sbt-updates/issues/10#issuecomment-280843080, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGAUFGxH1gC_LKzCBe5x4w9eXuujeL1ks5rduZlgaJpZM4BNUYg .
@nafg, idea is clear and understandable. But since I use custom tasks which depend on plugins, I prefer when projects don't depend on per-user defined plugins.
@slothspot have you read this? Do you actually define any tasks depending on this plugin in the meta-project? I doubt it. So adding this plugin to your global scope meta-project is actually what you want:
projects don't depend on per-user defined plugins
@laughedelic I've got main point already, and don't have any tasks depend on this plugin. But in general I prefer per-project plugins configuration and it was not clear for me after reading sbt-updates documentation that I need to define this plugin globally to make plugins update check work.
Anyone tried the workaround with sbt-updates 0.3.4 and sbt 1.1.1? I can't get it to work.
It works for some plugins (e.g. lagom) but not others (e.g. dependency-check).
Could probably look at https://github.com/scalacenter/load-plugin, which is able to load a plugin into the meta-build.
Any idea if/when this would be implemented? :)
This is not really an issue, but a feature request: it would be extremely awesome if one could check sbt plugin updates with this sbt plugin as well.