play framework: not found: value params

2019-04-09 12:53发布

问题:

Yesterday I had some problems with routes in my Play 2.1.1 app and deleted the contents of the target folder to force Play to recompile everything (probably a dumb idea).

Now I get a bunch of errors in Eclipse:

too many arguments for method apply: (name: String, constraint: String)play.core.DynamicPart in object DynamicPart  routes_routing.scala    /myapp/target/scala-2.10/src_managed/main   line 44 Scala Problem
too many arguments for method apply: (name: String, constraint: String)play.core.DynamicPart in object DynamicPart  routes_routing.scala    /myapp/target/scala-2.10/src_managed/main   line 40 Scala Problem
too many arguments for method apply: (name: String, constraint: String)play.core.DynamicPart in object DynamicPart  routes_routing.scala    /myapp/target/scala-2.10/src_managed/main   line 52 Scala Problem
too many arguments for method apply: (name: String, constraint: String)play.core.DynamicPart in object DynamicPart  routes_routing.scala    /myapp/target/scala-2.10/src_managed/main   line 48 Scala Problem
not found: value params routes_routing.scala    /myapp/target/scala-2.10/src_managed/main   line 96 Scala Problem
not found: value params routes_routing.scala    /myapp/target/scala-2.10/src_managed/main   line 88 Scala Problem
not found: value params routes_routing.scala    /myapp/target/scala-2.10/src_managed/main   line 112    Scala Problem
not found: value params routes_routing.scala    /myapp/target/scala-2.10/src_managed/main   line 104    Scala Problem

After some google and stackoverflow research I tried to perform a play clean compile on the project. That works. I can also start the application and it seems to work properly.

After the clean I tried a Refresh in Eclipse. That does not change anything. The errors won't go away.

Any suggestions?

Thanks!

回答1:

You need to regenerate the eclipse project

  1. Start play

    play
    
  2. Generate eclipse project (perform this step inside play console)

    eclipse with-source=true
    
  3. Refresh your eclipse project

    F5 (fn + F5 in Mac)
    

You don't have to delete the eclipse project every time you make important changes :-)



回答2:

Guess I found it:

First I ran play clean-all.

But I guess this is what really helped me:

I deleted the Eclipse project (In Eclipse right click > delete; without checking "delete contents on disk"). Then I ran play eclipse and imported the project into Eclipse.