【问题标题】:Suppress twirl template deprecation method warnings抑制旋转模板弃用方法警告
【发布时间】:2023-03-22 01:50:01
【问题描述】:

在从 play 2.4 迁移到 2.5 后,我们在 twirl 模板中遇到了弃用警告: ...web/templates/main.scala.html:159: method get in object Messages is deprecated: see corresponding Javadoc for more information. [warn] <a href="@routes.Authentication.login()">@Messages.get("login") </a> [warn] 1501 warnings found

scalaOptions 内的-deprecation 标志对类工作正常,但看起来它不会影响*.scala.html 文件。

Twirl wiki 提到了 withtwirlRecompilationLogger TaskKey (twirlRecompilationLogger = TaskKey[(File, File) =&gt; Unit]),但 play 2.5 不包含它 (play.twirl.sbt.TwirlKeys)。

任何想法如何抑制模板内的deprecation 警告? 谢谢

【问题讨论】:

    标签: playframework playframework-2.5 scalac twirl


    【解决方案1】:

    如果我们想抑制deprecation 警告,我们应该用false 修改flag,接下来是-deprecation:false,例如:

    scalacOptions ++= Seq("-deprecation:false")

    谷歌群讨论here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-02-19
      • 1970-01-01
      • 2011-02-06
      • 1970-01-01
      • 2017-04-04
      • 2015-06-16
      • 1970-01-01
      • 2015-08-05
      相关资源
      最近更新 更多