score:32
This is probably not the answer you are looking for and I admit it is not elegant but it currently works for me, meaning that I think it takes less time for me to periodically do the following instead of researching and finding a more elegant solution.
I assume you are using the sbt-eclipse plugin ( https://github.com/typesafehub/sbteclipse ). When I add new dependencies to my project ( which is actually pretty rare ) I simply regenerate my eclipse project files from the plugin. The downside of this is that I have a multiple module project and after I refresh the projects in eclipse I need to re-add the inter-project dependencies in the eclipse build path editor.
Like I mentioned it is pretty hacky but all in all I really don't loose that much time doing it. It's not pretty but it works.
Best of luck, Andy
score:0
The following works for me:
1) close project in Eclipse
2) in my file explorer, browse to my Eclipse project, make sure hidden files are visible
3) open .classpath in a simple text editor
4) copy the bottom entry. For example, in my current project, it is <classpathentry path="/home/natalie/.ivy2/cache/org.scalatest/scalatest_2.9.1/jars/scalatest_2.9.1-1.8.jar" kind="lib"></classpathentry>
5) navigate to my .ivy folder, cache, then down to the library I have added via sbt
6) right click on jar file, select properties, copy the path and jar file name and replace it in the entry I copied in step 4
7) save .classpath
8) open my project on Eclipse
New dependency is now available in Eclipse.
score:1
All you need is execute from your project home:
sbt "eclipse with-source=true"
or enter sbt
console and write:
eclipse with-source=true
BTW: I don't know if from Jan '12 something has changed but now it seems much more simple.
score:7
In command prompt go to the project folder and type
sbt eclipse
This should generate the appropriate .classpath entries in eclipse project.
Go back to eclipse, select the project and press f5, this will reload the referenced libs.
score:14
I use the Apache IvyDE plugin for Eclipse, and I've had more luck with this approach. It's only described in the old sbt docs, but works with sbt 0.11
First, install the IvyDE plugin in Eclipse and restart.
Run the sbt command deliver-local
- this will create an XML ivy file of your dependencies.
In Eclipse, under your Project/Properties - Java Build Path - Libraries, click "Add Library" and choose "IvyDE Managed Dependencies" then select the file target/scala-2.9.1/ivy-projectversion.xml
When you add a new dependency to build.sbt, run the sbt commands reload
and deliver-local
again. Then right-click the Ivy library for your project in the Package Explorer - it will be called "target/scala-2.9.1/ivy-projectversion.xml [compile,test]", and click the second "Refresh" menu item (between "Refresh" and "Reload Settings" - not "F5 Refresh" ).
score:87
If you are using sbteclipse plugin it's achievable in a simple way. In sbt type:
reload
eclipse with-source=true
Then in eclipse, hit F5 on a project folder to refresh it. Or right-click and choose "Refresh". Just works.
Source: stackoverflow.com
Related Query
- How to have Eclipse recognize dependencies from SBT
- How to prevent SBT from resolving the same dependencies for different projects
- How to get Intellij to use dependencies from SBT scala
- How to add dependencies in Eclipse which sbt and Play 2.0 can see
- How do I create a sbt build file from a mixed java/scala eclipse project?
- If I have an SBT multi-project build, how can I make A's test dependencies not leak in to B's tests
- How to get the dependencies of all sub-projects from a SBT project, in a SBT task?
- How to get Project dependencies from SBT console
- How to automatically remove from SBT snapshot dependencies during release?
- How do I declare SBT dependencies withSources that have test scope in published pom file?
- How to force IntelliJ IDEA to reload dependencies from build.sbt after they changed?
- How can sbt pull dependency artifacts from git?
- How to reference external sbt project from another sbt project?
- How to add native library dependencies to sbt project?
- How to attach sources to SBT managed dependencies in Scala IDE?
- How do I run an sbt main class from the shell as normal command-line program?
- Run SBT Task from Eclipse
- How can I call another task from my SBT task?
- How to have SBT re-run only failed tests
- how to prevent gitlab ci from downloading sbt every time?
- How to have SBT subproject with multiple Scala versions?
- How is an sbt task defined using <<= different from one defined with := that references another setting's .value?
- How do I get color coded console output from SBT on Windows?
- How to run tests on every code change in IntelliJ IDEA from Scala sbt project?
- How to prevent SBT to include test dependencies into the POM
- How to include test classes and test dependencies in sbt asssembly
- How to find out where sbt resolves dependencies from?
- How to prevent SBT from trying to download from official repositories?
- How can I get colored output from Maven and SBT on Windows?
- How to execute SBT plugin's tasks from within IntelliJ IDEA CE?
More Query from same tag
- What is the difference of BeforeAndAfter and BeforeAndAfterEach in ScalaTest
- Transform from List[Future[...] to List[...] in Scala
- Matching on nested exception type
- Find 73 palindromes
- Is a 50M jar file reasonable from 5k lines of scala code?
- Date intervals keeping state
- How mimic the function map.getORelse to a CSV file
- How to implement intermediate types for implicit methods?
- How can I get all object vals and subobject vals using reflection in Scala?
- scala: class members only accessible from subclass AND the subclass MUST in the same package. How?
- play command doesn't work when inside of an existing sbt project
- Scala: List drop first n empty items
- Actor Thread Safety
- How do I convert a java.util.UUID to doobie.syntax.SqlInterpolator.SingleFragment?
- Are there any Scala OAuth libraries that support OAuth 2.0?
- trait providing the Manifest to another trait
- Calling (overloaded) RxJava functions from Scala
- Dependency Injected APIs in custom Actions
- Combine values with same keys in Scala
- Scala: How to Filter Shapless HList based on Labels
- Compare two Json having different arrangement of items using scala
- Scala Eclipse IDE configuration
- Scala deserialization of custom scala object with play-json library
- Play 2.3 Jongo ObjectId to custom ID
- how to create key value RDD out of kafka topic data
- How to read a .csv with multiple lines in spark - scala?
- Returning a JSON array in Akka Http
- Applying implicit conversion to map
- Transitive dependencies not being pulled in build.sbt
- scala - make variable available inside block