简体   繁体   中英

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.

I have
Workspace
Common/src/Common/*.scala
MyProject/src/(default package)/foo.scala

How do I get MyProject to use my Common library code?

In MyProject foo.scala I import Common.Common (my package object) In MyProject properties, I've added a Project Reference. I've also tried 12 ways of adding it to the java build path.

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:

  • Make sure the Common project and MyProject project are both open.
  • Right click on MyProject -> Build Path -> Configure Build Path . That should open a dialog.
  • Choose the Projects tab
  • Click on the Add button - it should bring up another dialog where you can check the Common project. Thereafter it should appear in the list under the Projects tab.

Later, whenever you open the MyProject project the Common project will automatically be opened as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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