尝试使用播放器邮件插件时,我在编译时遇到以下错误:
[error] /Users/Luuk/Documents/Java/Y2kBooking/app/logic/support/Mails.java:4: package play.libs.mailer does not exist
[error] play.libs.mailer.Email
[error] /Users/Luuk/Documents/Java/Y2kBooking/app/logic/support/Mails.java:5: package play.libs.mailer does not exist
[error] play.libs.mailer.MailerClient
[error] /Users/Luuk/Documents/Java/Y2kBooking/app/logic/support/Mails.java:14: cannot find symbol
[error] symbol: class MailerClient
[error] location: class logic.support.Mails
[error] MailerClient
app/logic/support/Mails.java:24: cannot find symbol
[error] symbol: class Email
[error] location: class logic.support.Mails
这是我的邮件:
package logic.support;
import play.Configuration;
import play.libs.mailer.Email;
import play.libs.mailer.MailerClient;
import javax.inject.Inject;
public class Mails {
@Inject
MailerClient mailerClient;
public void sendLoggerEmail(String message, Exception e) {
String fullMessage = "The following error occured:\n" + message;
if (e != null) {
fullMessage += "\n\n" + "Error message:\n" + e.getMessage() + "\n\nStacktrace\n" + org.apache.commons.lang3.exception.ExceptionUtils.getStackTrace(e);
}
Email email = new Email();
email.setSubject("Booking application warning");
email.setFrom("Booking system FROM <" + Configuration.root().getString("adminEmail") + ">");
email.addTo("Webmaster TO <" + Configuration.root().getString("adminEmail") + ">");
email.setBodyText(fullMessage);
mailerClient.send(email);
}
}
在build.sbt:
libraryDependencies ++= Seq( javaJdbc , cache , javaWs , evolutions , "mysql" % "mysql-connector-java" % "5.1.18", "org.mockito" % "mockito-core" % "1.10.19" % "test", "com.typesafe.play" %% "play-mailer" % "3.0.1")
我确实清理了项目并重建,但总是一样。我正在使用Play(Java)2.4.4
[编辑:] jar存在,IDEA没有任何问题,因此它似乎在运行时不可用。
[EDIT2:] 只有在使用IDEA进行调试时才会出现此问题。使用激活器从终端运行工作正常。
答案 0 :(得分:0)
我发现这是IDEA调试会话的问题。 重启一切解决了这个问题。