简体   繁体   English

在Scala Eclipse中,如何在工作区中使用库

[英]In scala eclipse how do I use a library in my workspace

This should be super easy. 这应该超级容易。 I'm using Scala IDE 3.0.4 of Eclipse. 我正在使用Eclipse的Scala IDE 3.0.4。

I have 我有
Workspace 工作空间
Common/src/Common/*.scala Common / src / Common / *。scala
MyProject/src/(default package)/foo.scala MyProject / src /(默认包)/foo.scala

How do I get MyProject to use my Common library code? 如何让MyProject使用我的公共库代码?

In MyProject foo.scala I import Common.Common (my package object) In MyProject properties, I've added a Project Reference. 在MyProject foo.scala中,我导入Common.Common(我的包对象)。在MyProject属性中,我添加了一个Project Reference。 I've also tried 12 ways of adding it to the java build path. 我还尝试了12种将其添加到Java构建路径的方法。

What did I miss? 我错过了什么?

Thanks much 非常感谢

You don't indicate what the 12 ways you've tried are, but I think the following should work, assuming Common is another project in your workspace: 您没有说明尝试过的12种方法是什么,但是我认为下面的方法应该起作用,假设Common是工作空间中的另一个项目:

  • Make sure the Common project and MyProject project are both open. 确保Common项目和MyProject项目都已打开。
  • Right click on MyProject -> Build Path -> Configure Build Path . 右键单击MyProject > Build Path -> Configure Build Path That should open a dialog. 那应该打开一个对话框。
  • Choose the Projects tab 选择Projects选项卡
  • Click on the Add button - it should bring up another dialog where you can check the Common project. 单击Add按钮-它会弹出另一个对话框,您可以在其中检查Common项目。 Thereafter it should appear in the list under the Projects tab. 此后,它应出现在“ Projects选项卡下的列表中。

Later, whenever you open the MyProject project the Common project will automatically be opened as well. 以后,每当您打开MyProject项目时, Common项目也将自动打开。

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

相关问题 在Eclipse中,如何使用Navigator查看工作区外的文件? - In Eclipse, how do I use Navigator to look at files outside my workspace? 如何将旧文件从Java Eclipse工作区复制到新工作区中? - How do I copy over my old files from my Java Eclipse workspace into my new workspace? 我如何处理挂在工作区上的Eclipse的持久问题? - How do I deal with a persistent problem of Eclipse hanging on my workspace? 如何从php Eclipse工作区运行代码 - How do I run my code from php eclipse workspace Eclipse 说:​​“工作区正在使用或无法创建,请选择其他工作区。” 如何解锁工作区? - Eclipse says: “Workspace in use or cannot be created, chose a different one.” How do I unlock a workspace? 如何将Eclipse工作区导入到IntelliJ - How do I import an eclipse workspace into intelliJ 如何使用一个scala库进行maven / eclipse / scala - How to use just one scala library for maven/eclipse/scala 如何将定制ANT构建器与项目而不是Eclipse工作区关联? - How do I associate my custom ANT builder with the project instead of the Eclipse workspace? Eclipse PHP Zend:当我尝试在Apache2 / htdocs中设置工作区时,“工作区正在使用”? - Eclipse PHP Zend: “workspace in use” when i try to set my workspace in Apache2/htdocs? 我怎么能将我的eclipse的工作区添加到git存储库? - How could I add my eclipse's workspace to git repository?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM