Compiling sbt projects

32 views
Skip to first unread message

boris....@gmail.com

unread,
Jun 22, 2016, 9:09:38 AM6/22/16
to Scala IDE User
There are several projects on Github that have sbt makefiles. It seems that there are two ways to compile these:
  1. Install sbt and compile the project with sbt. This will install scala compiler and libraries, which seems wasteful because these are already installed as part of the Scala IDE.
  2. Convert the makefile to an Eclipse project with sbteclipse. Will this use the Scala installation inside the Scala IDE?
What is the recommended way to compile sbt projects on Github? I am interested in the resulting jars only becaus I want to use them in my Scala projects.

Simon Schäfer

unread,
Jun 22, 2016, 9:22:56 AM6/22/16
to scala-ide-user



---- On Wed, 22 Jun 2016 15:09:37 +0200 <boris....@gmail.com>wrote ----

There are several projects on Github that have sbt makefiles. It seems that there are two ways to compile these:
  1. Install sbt and compile the project with sbt. This will install scala compiler and libraries, which seems wasteful because these are already installed as part of the Scala IDE.
Every project needs different libraries and potentially also different versions for the compiler. The IDE can't ship all of them. Therefore, installing sbt and building the project with it is the way to go.
  1. Convert the makefile to an Eclipse project with sbteclipse. Will this use the Scala installation inside the Scala IDE?
Yes, it will. Actually, Scala is just a library therefore we can't really talk of an installation here. The IDE just loads the library at startup of your application.

What is the recommended way to compile sbt projects on Github? I am interested in the resulting jars only becaus I want to use them in my Scala projects.

Download the project and build the JAR with sbt.


--
You received this message because you are subscribed to the Google Groups "Scala IDE User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-ide-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Naftoli Gugenheim

unread,
Jun 26, 2016, 9:19:12 PM6/26/16
to Scala IDE User


On Wed, Jun 22, 2016, 9:09 AM <boris....@gmail.com> wrote:
There are several projects on Github that have sbt makefiles. It seems that there are two ways to compile these:
  1. Install sbt and compile the project with sbt. This will install scala compiler and libraries, which seems wasteful

In the sense of needing those extra few megabytes? Or just that it feels inelegant?

> because these are already installed as part of the Scala IDE.
> 2. Convert the makefile to an Eclipse project with sbteclipse.

That requires SBT and will run the updateClassifiers (IIRC) task, so it will download everything in #1, possibly more, because of sources and javadocs.

> Will this use the Scala installation inside the Scala IDE?
What is the recommended way to compile sbt projects on Github? I am interested in the resulting jars only becaus I want to use them in my Scala projects.

--

scala solist

unread,
Jun 27, 2016, 3:43:29 AM6/27/16
to Scala IDE User
There is no IDE actually compatible with SBT builds. All SBT compatibility plugins builds project configuration native to an IDE that should be equal to SBT one. But SBT has abilities that could not be reproduced as IDE configuration. And if project uses such features, IDE could not catch the project at all. There would be much better if an IDE would employ SBT directly and build GUI frontent for SBT backend. But neither one goes this way, so there is no true compatibility between SBT and IDE

Simon Schäfer

unread,
Jun 27, 2016, 5:51:16 AM6/27/16
to scala-ide-user



---- On Mon, 27 Jun 2016 09:43:28 +0200 scala solist <scala...@gmail.com>wrote ----

There is no IDE actually compatible with SBT builds. All SBT compatibility plugins builds project configuration native to an IDE that should be equal to SBT one. But SBT has abilities that could not be reproduced as IDE configuration. And if project uses such features, IDE could not catch the project at all. There would be much better if an IDE would employ SBT directly and build GUI frontent for SBT backend. But neither one goes this way, so there is no true compatibility between SBT and IDE

This is correct. Unfortunately, sbt was never seen by its authors as a foundation for IDEs, therefore building an IDE on top of it would result in a lot of pain. The current solution of converting sbt project files to IDE project files is only marginally less painful but at least it works in most of the cases.

On Monday, June 27, 2016 at 4:19:12 AM UTC+3, nafg wrote:


On Wed, Jun 22, 2016, 9:09 AM <boris....@gmail.com> wrote:
There are several projects on Github that have sbt makefiles. It seems that there are two ways to compile these:
  1. Install sbt and compile the project with sbt. This will install scala compiler and libraries, which seems wasteful

In the sense of needing those extra few megabytes? Or just that it feels inelegant?

> because these are already installed as part of the Scala IDE.
> 2. Convert the makefile to an Eclipse project with sbteclipse.

That requires SBT and will run the updateClassifiers (IIRC) task, so it will download everything in #1, possibly more, because of sources and javadocs.

> Will this use the Scala installation inside the Scala IDE?
What is the recommended way to compile sbt projects on Github? I am interested in the resulting jars only becaus I want to use them in my Scala projects.


--
You received this message because you are subscribed to the Google Groups "Scala IDE User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-ide-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Scala IDE User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-ide-use...@googlegroups.com.

Naftoli Gugenheim

unread,
Jun 27, 2016, 6:01:57 AM6/27/16
to scala-ide-user


On Mon, Jun 27, 2016, 5:51 AM Simon Schäfer <ma...@antoras.de> wrote:



---- On Mon, 27 Jun 2016 09:43:28 +0200 scala solist <scala...@gmail.com>wrote ----

There is no IDE actually compatible with SBT builds. All SBT compatibility plugins builds project configuration native to an IDE that should be equal to SBT one. But SBT has abilities that could not be reproduced as IDE configuration. And if project uses such features, IDE could not catch the project at all. There would be much better if an IDE would employ SBT directly and build GUI frontent for SBT backend. But neither one goes this way, so there is no true compatibility between SBT and IDE

This is correct. Unfortunately, sbt was never seen by its authors as a foundation for IDEs, therefore building an IDE on top of it would result in a lot of pain. The current solution of converting sbt project files to IDE project files is only marginally less painful but at least it works in most of the cases.

I don't understand what is so painful about the approach intellij takes (afaict) -- basically the ide invokes one of the update tasks and parses the output.


On Monday, June 27, 2016 at 4:19:12 AM UTC+3, nafg wrote:


On Wed, Jun 22, 2016, 9:09 AM <boris....@gmail.com> wrote:
There are several projects on Github that have sbt makefiles. It seems that there are two ways to compile these:
  1. Install sbt and compile the project with sbt. This will install scala compiler and libraries, which seems wasteful

In the sense of needing those extra few megabytes? Or just that it feels inelegant?

> because these are already installed as part of the Scala IDE.
> 2. Convert the makefile to an Eclipse project with sbteclipse.

That requires SBT and will run the updateClassifiers (IIRC) task, so it will download everything in #1, possibly more, because of sources and javadocs.

> Will this use the Scala installation inside the Scala IDE?
What is the recommended way to compile sbt projects on Github? I am interested in the resulting jars only becaus I want to use them in my Scala projects.


--
You received this message because you are subscribed to the Google Groups "Scala IDE User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-ide-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Scala IDE User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-ide-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Scala IDE User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-ide-use...@googlegroups.com.

scala solist

unread,
Jun 27, 2016, 7:15:31 AM6/27/16
to Scala IDE User
I perfectly understands that. I've tried to write an SBT plugin and found it quite painful: lack of documentation and obscure source code.

But from user perspective it is a pain to use SBT together with an IDE. They both run presentation compiler, consumes CPU and memory. And they do basically the same thing. I had dipped into SBT source code when was writing plugin, and discover that it extracts from presentation compiler all information needed for an IDE and store it internally. SBT uses the information for incremental building. But it is possible to use it for discovering function uses and other IDE stuff. The main problem is that SBT has no public API for accessing the internal information. And its format could change in new versions of the SBT.

Simon Schäfer

unread,
Jun 27, 2016, 7:17:08 AM6/27/16
to scala-ide-user



---- On Mon, 27 Jun 2016 12:01:45 +0200 Naftoli Gugenheim <nafto...@gmail.com>wrote ----



On Mon, Jun 27, 2016, 5:51 AM Simon Schäfer <ma...@antoras.de> wrote:




---- On Mon, 27 Jun 2016 09:43:28 +0200 scala solist <scala...@gmail.com>wrote ----

There is no IDE actually compatible with SBT builds. All SBT compatibility plugins builds project configuration native to an IDE that should be equal to SBT one. But SBT has abilities that could not be reproduced as IDE configuration. And if project uses such features, IDE could not catch the project at all. There would be much better if an IDE would employ SBT directly and build GUI frontent for SBT backend. But neither one goes this way, so there is no true compatibility between SBT and IDE


This is correct. Unfortunately, sbt was never seen by its authors as a foundation for IDEs, therefore building an IDE on top of it would result in a lot of pain. The current solution of converting sbt project files to IDE project files is only marginally less painful but at least it works in most of the cases.

I don't understand what is so painful about the approach intellij takes (afaict) -- basically the ide invokes one of the update tasks and parses the output.

Lots of problems:

- The updating is slow
- Parsing output is error-prone
- Implementing complexity because multiple build tools need to stay in sync
- Not all features of the internal or the external build tools can be reflected for the respectively other side.
- Multiple processes need to be run, which weakens the stability of the platform unless the platform can handle it well (neither Eclipse nor IntelliJ nor the JVM are good at it)
- and even more smaller details
Reply all
Reply to author
Forward
0 new messages