在具有Play Framework的Scala模板中找不到类
我有一个Play2框架应用程序,在IntelliJ Idea中完成缓存失效和重新启动后,重新编译时遇到问题。我得到的错误是:在具有Play Framework的Scala模板中找不到类,scala,intellij-idea,playframework,playframework-2.0,Scala,Intellij Idea,Playframework,Playframework 2.0,我有一个Play2框架应用程序,在IntelliJ Idea中完成缓存失效和重新启动后,重新编译时遇到问题。我得到的错误是: [warn] Class models.AgeGroup not found - continuing with a stub. [error] /Users/xxx/app/views/registrations/selectPrinterView.scala.html:13: not found: value AgeGroup [error]
[warn] Class models.AgeGroup not found - continuing with a stub.
[error] /Users/xxx/app/views/registrations/selectPrinterView.scala.html:13: not found: value AgeGroup
[error] @for( (k, v) <- AgeGroup.optionsForGroups()) {
[error] ^
[error] /Users/xxx/app/views/registrations/selectPrinterView.scala.html:14: overloaded method value apply with alternatives:
[error] (keys: Seq[String],args: Any*)(implicit messages: play.api.i18n.Messages)String <and>
[error] (key: String,args: Any*)(implicit messages: play.api.i18n.Messages)String
[error] cannot be applied to (Any)
[error] <option value="@k">@Messages(v)</option>
[error]
[warn]找不到Class models.AgeGroup-继续使用存根。
[错误]/Users/xxx/app/views/registrations/selectPrinterView.scala.html:13:未找到:值年龄组
((k,v)的[错误]@我使用了命令行“Activator”,在那里运行了一个干净的程序并进行了编译。出于某种原因,现在它似乎在Activator和IDEA中都能工作。需要导入模型。AgeGroup
在模板中我现在得到了“object AgeGroup不是包模型的成员”。我不明白为什么它一直工作后就不能工作。我喜欢它它不包括在构建中
<select name="ageGroup">
@for( (k, v) <- AgeGroup.optionsForGroups()) {
<option value="@k">@Messages(v)</option>
}
</select>
package models;
import play.i18n.Messages;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* Created on 25/11/2015.
*/
public enum AgeGroup {
U18,
O18,
BOTH,
SPECIAL;
public static Map<String, String> optionsForGroups() {
LinkedHashMap<String, String> vals = new LinkedHashMap<>();
vals.put(U18.name(), Messages.get(U18.name()));
vals.put(O18.name(), Messages.get(O18.name()));
vals.put(BOTH.name(), Messages.get(BOTH.name()));
return vals;
}
public static Map<String, String> optionsForRooms() {
LinkedHashMap<String, String> vals = new LinkedHashMap<>();
vals.put(U18.name(), Messages.get(U18.name()));
vals.put(O18.name(), Messages.get(O18.name()));
vals.put(SPECIAL.name(), Messages.get(SPECIAL.name()));
return vals;
}
}