New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unused import warning in routes (Play 2.6.0-RC1 and Scala 2.12.2) #7382
Comments
Hey @maxcom, If you are not using import play.sbt.routes.RoutesKeys
RoutesKeys.routesImport := Seq.empty Can you confirm that using this configuration fixes the problem for you? playframework/framework/src/sbt-plugin/src/main/scala/play/sbt/PlaySettings.scala Line 134 in 927fb83
Thanks. |
Thanx, I used
That did reduce number of warnings, but did not solve all of them. |
Other unused imports are
in |
Thanks for the feedback, @maxcom. Is WDYT? |
I'm not sure that it will help. Reverse routes is not the one file, but it is generated for each individual package. Some controllers uses only base types, some uses custom types and Options. Maybe there is the way to disable this warnings for generated files only? |
I just want to chime in I am seeing what I believe is the same warning except in my template files: scala 2.12.4
|
Disabling -Xlint gets rid of the warnings - having said that this feels like a regression. |
This is still happening with application code scala 2.12.4 |
This still occurs in Scala 2.12.5, play 2.6.12. The warning comes from Adding:
To the bulid does solve the problem but it is annoying that this is needed. |
This also seems to be triggered when using multiple routes files like:
Compilation fails with:
|
I'm having the same problem while upgrading to play 2.6 and scala 2.12 - also the project is gradle-based so I was wondering if there's any workaround for gradle. I looked into it and couldn't find any... |
Hi @iaco86, when using Gradle, I think you can tweak the |
|
I've introduced a way to silence the
|
I was following your PR, thanks a lot @mihaisoloi ! |
With Scala 2.13.2's configurable warnings you can suppress all warnings like this: scalacOptions += s"-Wconf:src=${target.value}/.*:s" |
A variation on @mihaisoloi's solution which limits the scope of silencer a bit more:
If you have other paths that you are filtering then you can relativize the target to the base directory and put that in the filter instead. |
For anyone looking for a no-plugin solution, I've come up with a working one for Scala 2.13.7: https://stackoverflow.com/a/70418263/804812 |
Play Version (2.5.x / etc)
2.6.0-RC1
API (Scala / Java / Neither / Both)
Scala
Expected Behavior
Play-2.6.0-RC1 project can be compiled with "-Xfatal-warnings" compiler option and Scala 2.12.2.
Actual Behavior
I think that unused import is
in generated
Routes
andReverseRoutes
The text was updated successfully, but these errors were encountered: