简体   繁体   English

带有Play框架的Eclipse类路径

[英]Eclipse Classpath with Play Framework

I'm trying to run a small Play application (well, the tests really) in Eclipse and I've come up against a frustrating problem. 我试图在Eclipse中运行一个小的Play应用程序(嗯,实际上是测试),但遇到了一个令人沮丧的问题。 When I run the command from the command line all the tests are successful, but from Eclipse I've found that it is unable to load some of our required properties files. 当我从命令行运行命令时,所有测试均成功,但是从Eclipse中,我发现它无法加载某些必需的属性文件。 Looking at the target directory I see two compiled class folders, classes and classes_managed . 查看目标目录,我看到两个编译的类文件夹, classesclasses_managed The properties files are in the classes directory, as I'd expect, but when I look to the class that's attempting to load the properties file the classpath appears to only have the classes_managed directory, which doesn't contain the properties files that are required. 正如我所期望的那样,属性文件位于classes目录中,但是当我尝试尝试加载属性文件的类时,classpath似乎仅具有classes_managed目录,其中不包含必需的属性文件。

For reference I am running these as JUnit tests so that I can debug them. 作为参考,我将它们作为JUnit测试运行,以便可以对其进行调试。 I've run play eclipse on the command line and imported the project to Eclipse as suggested in the documentation. 我已经在命令行上运行play eclipse,并且按照文档中的建议将项目导入了Eclipse。 I'm using Eclipse Kepler and Play 2.2.3. 我正在使用Eclipse Kepler和Play 2.2.3。

Any help would be appreciated. 任何帮助,将不胜感激。

If those files are not getting added to the classpath properly, you can ensure they're accessible by specifically telling sbt that they need to be on the classpath with: 如果这些文件没有正确添加到类路径中,则可以通过专门告诉sbt它们必须位于类路径中来确保它们可访问:

unmanagedClasspath in Test <+= baseDirectory map { bd => Attributed.blank(bd / "conf") }

put this line somewhere in your build.sbt file 将此行放在build.sbt文件中的某处

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM