【问题标题】:addSbtPlugin(...) cause eviction warning but 'evicted' command shows nothingaddSbtPlugin(...) 导致驱逐警告,但“驱逐”命令什么也没显示
【发布时间】:2019-01-05 05:05:42
【问题描述】:

使用 sbt 1.2.7 和 sbt-pgp 插件,sbt 会显示驱逐警告。

$ rm -rf target project/target && sbt ";clean;compile"
[info] Loading global plugins from /home/kbigwheel/.sbt/1.0/plugins
[info] Loading project definition from /home/kbigwheel/code/_investigation/2019-01-04-evicted-warning-investigation-3/plugins/project/project
[info] Loading settings for project plugins-build from test.sbt ...
[info] Loading project definition from /home/kbigwheel/code/_investigation/2019-01-04-evicted-warning-investigation-3/plugins/project
[info] Updating ProjectRef(uri("file:/home/kbigwheel/code/_investigation/2019-01-04-evicted-warning-investigation-3/plugins/project/"), "plugins-build")...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.
[info] Loading settings for project plugins from build.sbt ...
[info] Set current project to plugins (in build file:/home/kbigwheel/code/_investigation/2019-01-04-evicted-warning-investigation-3/plugins/)
[success] Total time: 0 s, completed 2019/01/05 13:27:05
[info] Updating ...
[info] Done updating.
[success] Total time: 0 s, completed 2019/01/05 13:27:05

但是,被驱逐的命令什么也没显示。

$ sbt evicted
[info] Loading global plugins from /home/kbigwheel/.sbt/1.0/plugins
[info] Updating ProjectRef(uri("file:/home/kbigwheel/.sbt/1.0/plugins/"), "global-plugins")...
[info] Done updating.
[info] Loading project definition from /home/kbigwheel/proj-name/project/project
[info] Updating ProjectRef(uri("file:/home/kbigwheel/proj-name/project/project/"), "proj-name-build-build")...
[info] Done updating.
[info] Loading settings for project proj-name-build from test.sbt ...
[info] Loading project definition from /home/kbigwheel/proj-name/project
[info] Updating ProjectRef(uri("file:/home/kbigwheel/proj-name/project/"), "proj-name-build")...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.
[info] Set current project to proj-name (in build file:/home/kbigwheel/proj-name/)
[info] Updating ...
[info] Done updating.
[success] Total time: 0 s, completed 2019/01/05 13:52:46

附加信息

  1. 使用 sbt 1.1.6,没有警告
  2. 使用 sbt 1.2.0,出现警告
  3. sbt-sonatype,没有警告
  4. 使用sbt-native-packager,出现警告

因此,此警告必须发生在特定插件和 sbt 1.2.0 或更高版本中。

转载来源:https://github.com/bigwheel/sbt-unknown-evicted-warning

为什么会显示警告?以及如何解决此消息?

【问题讨论】:

    标签: scala sbt


    【解决方案1】:

    记住SBT is recuersive - 这意味着,SBT 使用 SBT构建 SBT 用于构建你的项目。

    您看到的eviction警告不是针对您的主项目,而是针对元项目!
    您可以通过使用reload plugins 命令在元项目中运行evicted 命令来检查这一点。
    (我将使用 sbt 作为 shell 而不是批处理命令执行器,这对于发展)

    $ sbt
    [info] Updated file /home/balmungsan/sbt-unknown-evicted-warning/project/build.properties: set sbt.version to 1.2.7
    [info] Loading settings for project global-plugins from plugins.sbt ...
    [info] Loading global plugins from /home/balmungsan/.sbt/1.0/plugins
    [info] Loading project definition from /home/balmungsan/sbt-unknown-evicted-warning/project/project
    [info] Updating ProjectRef(uri("file:/home/balmungsan/sbt-unknown-evicted-warning/project/project/"), "sbt-unknown-evicted-warning-build-build")...
    [info] Done updating.
    [warn] There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.
    [info] Loading settings for project sbt-unknown-evicted-warning-build from plugins.sbt ...
    [info] Loading project definition from /home/balmungsan/sbt-unknown-evicted-warning/project
    [info] Updating ProjectRef(uri("file:/home/balmungsan/sbt-unknown-evicted-warning/project/"), "sbt-unknown-evicted-warning-build")...
    [info] Done updating.
    [warn] There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.
    [info] Set current project to sbt-unknown-evicted-warning (in build file:/home/balmungsan/sbt-unknown-evicted-warning/)
    [info] sbt server started at local:///home/balmungsan/.sbt/1.0/server/91ac4486f32705bdcc38/sock
    sbt:sbt-unknown-evicted-warning> evicted
    [info] Updating ...
    [info] Done updating.
    [success] Total time: 3 s, completed Jan 5, 2019 9:49:12 AM
    
    sbt:sbt-unknown-evicted-warning> reload plugins
    [info] Loading settings for project global-plugins from plugins.sbt ...
    [info] Loading global plugins from /home/balmungsan/.sbt/1.0/plugins
    [info] Loading project definition from /home/balmungsan/sbt-unknown-evicted-warning/project/project
    [info] Updating ProjectRef(uri("file:/home/balmungsan/sbt-unknown-evicted-warning/project/project/"), "project-build")...
    [info] Done updating.
    [warn] There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.
    [info] Loading settings for project project from plugins.sbt ...
    [info] Loading project definition from /home/balmungsan/sbt-unknown-evicted-warning/project
    
    sbt:project> evicted
    [info] Updating ProjectRef(uri("file:/home/balmungsan/sbt-unknown-evicted-warning/project/"), "project")...
    [info] Done updating.
    [info] Here are other dependency conflicts that were resolved:
    [info]  * org.scala-lang.modules:scala-parser-combinators_2.12:1.0.5 is selected over 1.0.4
    [info]      +- com.jsuereth:pgp-library_2.12:1.1.1                (depends on 1.0.5)
    [info]      +- com.typesafe:ssl-config-core_2.12:0.2.2            (depends on 1.0.4)
    [success] Total time: 11 s, completed Jan 5, 2019 9:50:25 AM
    

    PS:要返回主项目,请执行reload return 命令)

    【讨论】:

    • 这根本无法回答为什么会发出警告。使用reload plugins,您可以看到解析器组合器 1.0.5 被选择而不是 1.0.4,它是二进制兼容的,因此只记录 [info] 而不是 [warn]
    • @0__ 不管它们是否二进制兼容,如果发生驱逐,SBT 都会发出警告(至少在至少 10 个不同的存储库中,我一直都是这种情况)。现在,事实是,当您运行evicted 命令时,它只会在warning 不兼容二进制文件的情况下降低 - 但显示已发生驱逐的第一个警告是......嗯......一个@ 987654335@.
    • 我终于找到了在 sbt 1.2.0 之后出现这个警告的原因。 developer.lightbend.com/blog/2018-07-02-sbt-1-2-0/index.html github.com/sbt/sbt/pull/3947 "默认只显示驱逐警告摘要" 似乎默认驱逐打印行为在 1.2.0 中发生了变化。
    • 抱歉,第二个链接丢失。 github.com/sbt/librarymanagement/pull/211 这是正确的。
    • @bigwheel 随意编辑此答案或提供您自己的答案;)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-20
    • 2020-10-02
    • 1970-01-01
    • 1970-01-01
    • 2018-11-12
    • 2013-12-14
    相关资源
    最近更新 更多