为什么Eclipse无法解析Play 2.2.x应用程序中的Guice导入? [英] Why is Eclipse not able to resolve Guice import in Play 2.2.x application?

查看:95
本文介绍了为什么Eclipse无法解析Play 2.2.x应用程序中的Guice导入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Play 2.2.2项目中使用Google Guice注入.我的build.sbt文件包含以下内容:

I'm trying to use Google Guice Injections in my Play 2.2.2 project. My build.sbt file contains this:

libraryDependencies ++= Seq(
  javaJdbc,
  javaEbean,
  cache,
  "com.google.inject" % "guice" % "4.0-beta",
  "ws.securesocial" %% "securesocial" % "2.1.4",
  "postgresql" % "postgresql" % "9.1-901-1.jdbc4"
)

运行play dependencies时,可以看到guice依赖关系已正确解决.但是,当尝试执行import com.google.inject.*语句时,该库似乎不可用:

When running play dependencies, I can see that the guice dependency is being resolved correctly. However, when trying to make the import com.google.inject.* statement it seems that the library is not available:

其他导入的依赖项都没有这个问题,我在这里做什么错了?

I don't have this problem with any other imported dependencies, what am I doing wrong here?

推荐答案

在控制台上的项目目录中尝试此命令-

Try this command on console in your project directory -

您的项目目录$:> 播放编译Eclipse

your project dir $:> play compile eclipse

,然后在eclipse上刷新您的项目.

and then refresh your project on eclipse.

Play在eclipse上没有任何插件,但是play提供了将项目导入eclipse的实用程序.因此,每当添加新的依赖项时,都应编译并使其项目偏食,否则eclipse将无法理解新的依赖项导入.

Play doesn't have any plugin on eclipse but play provide the utility to import your project into eclipse. so whenever you add a new dependency you should compile and eclipsify your project otherwise eclipse will not understand the new dependency imports.

这篇关于为什么Eclipse无法解析Play 2.2.x应用程序中的Guice导入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆