Where can I download Scala source jars (scala-library-src.jar etc.) - scala

I am trying to use IntelliJ Idea Scala plugin, but it says it wants scala-library-src.jar, scala-swing-src.jar, scala-dbc-src.jar. Where can I download these files? I use Scala 2.8.

Get them from the Scala Maven repo at https://oss.sonatype.org/content/groups/scala-tools/.
In particular, https://oss.sonatype.org/content/groups/scala-tools/org/scala-lang/ has all the Scala library jars.

Go to http://scala-lang.org/files/archive/ and find the version you want that ends in .zip. Get that and extract it.
If you get the msi file then it doesn't install the src dir, but the zip does contain src.

Related

how to keep jar dependancy while checking in code

I have a scala project built with dependancy on a locally built jar file (java code). Once I need to check in my scala code into a different environment for building and deployment, what's the best way to keep my jar file in the dependancy?
I know that if I use the sbt dependancy from online modules, I don't need to worry, it will download the version and build, but what if I want to use my own jar file for this purpose?
This is in OSX, and code will be checked into linux machines, I am using intellij and sbt to manage my scala project. I also used intellij to build my external java lib into jar file and added dependancy of this specific path.
I hope there should be some generic solution, but I am new in JAVA and SBT
I got it figured out. Add the jar files under the lib directory right under the project will solve the problem. SBT will pick it up automatically and you can certainly check in the jar files like source code.

Adding dependencies to eclipse

I want to use Choco 3.3.1 in my eclipse project. I added the needed jar file to the java build path. But in the readme file it says that I also need to add the required dependencies. They look like this:
org.javabits.jgrapht:jgrapht-core:jar:0.9.3
dk.brics.automaton:automaton:jar:1.11-8
args4j:args4j:jar:2.32
net.sf.trove4j:trove4j:jar:3.0.3
org.slf4j:slf4j-api:jar:1.7.13
Where can I add those without maven, gradle etc.?
(The project is a scala project, but I don't think that's the problem)
The easiest way is probably to locate and download them from the Maven Central repository. You can search by artifact and/or group ID and locate the exact version(s) you're looking for. For example, here's the search for the jgrapht JAR.
Having said that, why not use Gradle, which has Scala support? Or sbt, the Scala build tool? You should at least give those some consideration.

Why it took so long to download sbt dependencies when I create a scala project in intellij idea?

I am new to scala, when I create a scala project in intellij it took really so long to download all the jar files. I have installed the scala plugin for idea IDE. Could anyone please tell me what should I do to get on the right track? Thanks very much.
Since the scala language is really a library on top of the JVM, creating a scala project for the first time requires the download of the specified scala version from a maven repository (usually this is at least the compiler and library, which for 2.10 comes to ~20MB). This will happen the first time, even if you've installed that same version of scala on your machine outside of sbt.
Once you go through this the first time, though, the next project you create--whether via sbt on the command line or via an IntelliJ sbt project--will pull these dependencies from your local ivy cache instead.
However, should you change the language version in your project, it will once again have to download the full language dependencies for that version.
In the screenshot it try to download the source files of one of of the dependencies. That mean it will try to download not only the compiled jars, but also it's source and docs.
only after downloading all of them, the project will be ready.
Disable to downloading of the sources and docs, and it will be much faster. How to disable it depends on how you create the project. (eg if you create sbt project, make sure to uncheck the "download sources and docs" in the creation/import wizard)

Link to library for Scala parser combinators in Eclipse

I created an Eclipse project using parser combinators using Scala 2.10. Recently I upgraded the Scala IDE plugin in Eclipse to version 3.0.4, which includes Scala 2.11. This new version of Scala has removed the scala.util.parsing.combinator package from the core Scala library. As a consequence, my upgraded Eclipse project has a plethora of "not found" errors.
The Scala website has some instructions for adding Maven and SBT dependencies for parser combinators. However, I can't find any instructions on scala-lang.org or scala-ide.org for linking to parser combinators. The full download of Scala (http://www.scala-lang.org/download/) includes a JAR for parser combinators, but I can't find the source attachment JAR for debugging. The Scala Eclipse plugin lacks the parser library (even though it includes other spun-out libraries like Scala Swing). I don't want to use Maven or SBT.
What is the easiest way to add Scala parser combinators (including source attachment) to an Eclipse project?
The easiest way is to use Sbt or Maven. Otherwise you need to manually download the jar file and corresponding sources from here.
You can add the scala-parser-combinators.jar to your build path (Project Properties -> Java Build Path), and then go to Libraries, click on Add External Jar. Once you have the jar, navigate to Source Attachment under the jar name and double-click to attach sources.
Please take my example projects as a starting point. They are using sbt so you can import them into Eclipse.
The 1st is a relatively simple expression parser https://github.com/scala-szeged/top-calc-dsl
The 2nd is a complete example language interpreter in 200 lines handling nested if, while, int, bool, array and variables https://github.com/scala-szeged/hrank-while-language

How do I get Eclipse to see Scala sources in a jar?

I get the following Eclipse error when browsing a binary scala jar dependency :
Source not found
The source attachment does not contain the source for the file Http.class
You can change the source attachment by clicking Change Attached Source below
The source attachment is a jar file containing the .scala source files, and clicking the button and re-navigating to the jar does nothing. Is there a way to get it to work?
Incidentally, this is a dependency brought in by using the SBT eclipse plugin, using the withSources() dependency
You should make sure to match your package structure with your directory structure as required in java.
Make sure that you have installed scala IDE for Eclipse Source Feature.And then you can
attach sources to scala-library in eclipse for scala projects
install scala IDE for Eclipse Source Feature