This page is no longer maintained — Please continue to the home page at www.scala-lang.org

ENSIME Working with multiple project dependencies?

5 replies
Sebastien Bocq
Joined: 2008-12-18,
User offline. Last seen 42 years 45 weeks ago.
Hi,

I recently converted to ensime and I'm wondering if someone could share pointers or offer some simple receipts, maybe build files, to work with multiple projects conveniently with ensime and emacs. So far I've been relying on eclipse for this (no ant or sbt) which means I need to fill up some gap but it doesn't need to be elaborated. I just need something like edit/compile project A and refresh/edit project B to get started.

Thanks!
Sébastien
Aemon Cannon
Joined: 2010-03-21,
User offline. Last seen 1 year 24 weeks ago.
Re: ENSIME Working with multiple project dependencies?

Hi Sébastien,

Ensime has some support for sbt projects with multiple sub-projects. You
can declare dependencies between the projects in the Ensime config file.

But I'm not sure how your projects are related, and if it makes sense to
manage them this way.

Otherwise, the simplest thing is create an ensime config for each
project. If B depends on A, then you can add A's jar to B's compile-jars.

Whenever you change and recompile A, you'd need to invoke ensime-reload
in project B, so the compiler can load the new classes.

Aemon

On 11/09/2010 02:31 AM, Sébastien Bocq wrote:
> Hi,
>
> I recently converted to ensime and I'm wondering if someone could share
> pointers or offer some simple receipts, maybe build files, to work with
> multiple projects conveniently with ensime and emacs. So far I've been
> relying on eclipse for this (no ant or sbt) which means I need to fill
> up some gap but it doesn't need to be elaborated. I just need something
> like edit/compile project A and refresh/edit project B to get started.
>
> Thanks!
> Sébastien

Sebastien Bocq
Joined: 2008-12-18,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: ENSIME Working with multiple project dependencies?
Thanks, that's the kind of info I'm looking for.

I work only with top level projects so If I understand correctly, what I can do is:
- create a sbt build file for each project
- open an emacs desktop window for each project under active dev
- project A: ensime-reload, edit, compile and export jar to a top level ../lib dir using sbt.
  Is there a emacs shortcut to invoke immediately a sbt target?
- project B: ensime-reload, edit, compile, etc.

And add the following line to ensime config:
:compile-jars  ("./lib", "../lib")

Thinking about this, it is a bit more manual work but if emacs could replicate eclipse "project export" facility I wouldn't need to depend on sbt. Would it make sense for Ensime to support an extra shortcut to create a jar from files in :target using "java -jar ..." cmd, to say :export-dir or an argument passed to the minibuffer or better I forget about this?

Sebastien

2010/11/10 Aemon Cannon <aemoncannon [at] gmail [dot] com>
Hi Sébastien,

Ensime has some support for sbt projects with multiple sub-projects. You can declare dependencies between the projects in the Ensime config file.

But I'm not sure how your projects are related, and if it makes sense to manage them this way.

Otherwise, the simplest thing is create an ensime config for each project. If B depends on A, then you can add A's jar to B's compile-jars.

Whenever you change and recompile A, you'd need to invoke ensime-reload
in project B, so the compiler can load the new classes.

Aemon
Aemon Cannon
Joined: 2010-03-21,
User offline. Last seen 1 year 24 weeks ago.
Re: ENSIME Working with multiple project dependencies?

> what I can do is:

Yep, that should work.

> project export

I'm a fan of letting build scripts do what they're good at - and sbt
is damn good at building projects :) Do you have a compelling
reason not to use sbt (out of curiosity)?

On 11/10/2010 02:36 AM, Sébastien Bocq wrote:
> Thanks, that's the kind of info I'm looking for.
>
> I work only with top level projects so If I understand correctly, what I
> can do is:
> - create a sbt build file for each project
> - open an emacs desktop window for each project under active dev
> - project A: ensime-reload, edit, compile/ /and export jar to a top
> level ../lib dir using sbt.
> Is there a emacs shortcut to invoke immediately a sbt target?
> - project B: ensime-reload, edit, compile//, etc.
>
> And add the following line to ensime config:
> *:compile-jars ("./lib", "../lib")*
>
> Thinking about this, it is a bit more manual work but if emacs could
> replicate eclipse "project export" facility I wouldn't need to depend on
> sbt. Would it make sense for Ensime to support an extra shortcut to
> create a jar from files in *:target* using "java -jar ..." cmd, to say
> *:export-dir* or an argument passed to the minibuffer or better I forget
> about this?
>
> Sebastien
>
> 2010/11/10 Aemon Cannon >
>
> Hi Sébastien,
>
> Ensime has some support for sbt projects with multiple sub-projects.
> You can declare dependencies between the projects in the Ensime
> config file.
>
> But I'm not sure how your projects are related, and if it makes
> sense to manage them this way.
>
> Otherwise, the simplest thing is create an ensime config for each
> project. If B depends on A, then you can add A's jar to B's
> compile-jars.
>
> Whenever you change and recompile A, you'd need to invoke ensime-reload
> in project B, so the compiler can load the new classes.
>
> Aemon
>

Aemon Cannon
Joined: 2010-03-21,
User offline. Last seen 1 year 24 weeks ago.
Re: ENSIME Working with multiple project dependencies?

> what I can do is:

Yep, that should work.

> project export

I'm a fan of letting build scripts do what they're good at - and sbt
is damn good at building projects :) Do you have a compelling
reason not to use sbt (out of curiosity)?

On 11/10/2010 02:36 AM, Sébastien Bocq wrote:
> Thanks, that's the kind of info I'm looking for.
>
> I work only with top level projects so If I understand correctly, what I
> can do is:
> - create a sbt build file for each project
> - open an emacs desktop window for each project under active dev
> - project A: ensime-reload, edit, compile/ /and export jar to a top
> level ../lib dir using sbt.
> Is there a emacs shortcut to invoke immediately a sbt target?
> - project B: ensime-reload, edit, compile//, etc.
>
> And add the following line to ensime config:
> *:compile-jars ("./lib", "../lib")*
>
> Thinking about this, it is a bit more manual work but if emacs could
> replicate eclipse "project export" facility I wouldn't need to depend on
> sbt. Would it make sense for Ensime to support an extra shortcut to
> create a jar from files in *:target* using "java -jar ..." cmd, to say
> *:export-dir* or an argument passed to the minibuffer or better I forget
> about this?
>
> Sebastien
>
> 2010/11/10 Aemon Cannon >
>
> Hi Sébastien,
>
> Ensime has some support for sbt projects with multiple sub-projects.
> You can declare dependencies between the projects in the Ensime
> config file.
>
> But I'm not sure how your projects are related, and if it makes
> sense to manage them this way.
>
> Otherwise, the simplest thing is create an ensime config for each
> project. If B depends on A, then you can add A's jar to B's
> compile-jars.
>
> Whenever you change and recompile A, you'd need to invoke ensime-reload
> in project B, so the compiler can load the new classes.
>
> Aemon
>

Sebastien Bocq
Joined: 2008-12-18,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: ENSIME Working with multiple project dependencies?

I'm a fan of letting build scripts do what they're good at - and sbt
is damn good at building projects :)  Do you have a compelling
reason not to use sbt (out of curiosity)?

It is a long story. Let's say I do not fancy build scripts and I like to keep things simple :) I will have a look at sbt, it has a name that bodes well.

Thanks a lot,
Sebastien

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland