Re: filter dependencies on eclipse task - like m2e's workspace resolution

85 views
Skip to first unread message

Viktor Hedefalk

unread,
Jun 6, 2013, 7:15:06 PM6/6/13
to simple-b...@googlegroups.com
Have you seen this thread?


I guess we want the same thing, right?


On Friday, June 7, 2013 12:40:58 AM UTC+2, Blue Thomas wrote:
I'm brand new to sbt so I'm sure this is something I should be able to wrangle with some experience, but is there a way to filter a project's libraryDependencies Seq when I run the 'eclipse' task? I want to explicitly filter the dependencies out for what I have in my Eclipse workspace (similar to M2Eclipse's workspace resolution).

(if there was a way to get the 'eclipse' plugin to write project entries in .classpath, that would be brilliant)

Thanks!

Heiko Seeberger

unread,
Jun 6, 2013, 7:17:16 PM6/6/13
to simple-b...@googlegroups.com
Not sure if I understand your question correctly: You want to modify (filter) the .classpath file sbteclipse (the eclipse command) creates?
Not sure why, because you will probably end up with a project that won't compile, but here is a way: classpathEntryTransformer setting (see https://github.com/typesafehub/sbteclipse/wiki/Using-sbteclipse for details).

Heiko

--

Heiko Seeberger
Twitter: @hseeberger

On Jun 7, 2013, at 12:40 AM, Blue Thomas <blue....@gmail.com> wrote:

I'm brand new to sbt so I'm sure this is something I should be able to wrangle with some experience, but is there a way to filter a project's libraryDependencies Seq when I run the 'eclipse' task? I want to explicitly filter the dependencies out for what I have in my Eclipse workspace (similar to M2Eclipse's workspace resolution).

(if there was a way to get the 'eclipse' plugin to write project entries in .classpath, that would be brilliant)

Thanks!

--
You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simple-build-t...@googlegroups.com.
To post to this group, send email to simple-b...@googlegroups.com.
Visit this group at http://groups.google.com/group/simple-build-tool?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Robin Green

unread,
Jun 7, 2013, 4:27:56 AM6/7/13
to simple-b...@googlegroups.com
On Friday, 7 June 2013 00:15:06 UTC+1, Viktor Hedefalk wrote:
Have you seen this thread?


I guess we want the same thing, right?

Very surprisingly, this sometimes "just works" with the latest version of sbteclipse (inasmuch as sbteclipse-generated Eclipse projects sometimes depend on other Eclipse projects), but sometimes doesn't. I haven't investigated why.

Viktor Hedefalk

unread,
Jun 7, 2013, 8:38:23 AM6/7/13
to simple-b...@googlegroups.com
Really? I had no idea. I've been dreaming that somebody else would
start to have this need and build something to make it work :)

Isn't it just if you have subprojects inside a super-project that the
subprojects interdependencies gets resolved as eclipse interproject
deps? That's not really enough for me.

I sometimes need to work simultaneously on a completely external
snapshot dependency. Typically I manually modify the .classpath file
and exchange the ivy-dependency to a project dependency. But then
every time I regenerate the depending projects .classpath I need to
redo this.

Please, please let me know if what I ask for is already there and I
have missed out!

Cheers,
Viktor

Blue Thomas

unread,
Jun 7, 2013, 2:43:53 PM6/7/13
to simple-b...@googlegroups.com
Heiko, thanks for the response. I saw that transformer doc after I posted this, which looks like it's possibly a route to my end goal.

I just wanted any easy way to hijack the execution of 'eclipse' so I could filter out certain entries in libraryDependencies when 'eclipse' was executed (or one step better - transform certain entries to the .classpath as a non-binary, project classpath entry) then continue calling 'eclipse' as normal. This is basically a way for me to have 'eclipse' generate the .classpath I want without manually updating my Eclipse project's build path afterward. Because I'm lazy and hate repeating myself.

That said, it's not stopping me from getting real work done.


Viktor, very similar.

Robin, do you have your dependency as both an Eclipse project and a binary jar on your build path? Ordering matters.

Thanks all

-Blue

Robin Green

unread,
Jul 6, 2013, 7:36:18 AM7/6/13
to simple-b...@googlegroups.com
I found another alternative that affects sbt generally, not just generated Eclipse projects: 


But personally I used classpathEntryTransformer because I want sbt's compilation behaviour to stay the same (since we are not using Jenkins for snapshots, only for releases, I want to make sure that snapshots are only published from my machine when built against other versions that are also published).

Of course the simplest alternative is just to use sbt subprojects. But I tend to only use them for very closely related projects.

Viktor Hedefalk

unread,
Jul 8, 2013, 3:51:44 AM7/8/13
to simple-b...@googlegroups.com
Cool!

I'm gonna try this one out! Thanks for sharing! Wouldn't it be good
enough to just have the symlinks in your dev machine and git ignore?

By the way, if you would like to show how you solved this using
classpathEntryTransformer I'd be really grateful!

Cheers,
VIktor
> Visit this group at http://groups.google.com/group/simple-build-tool.
Reply all
Reply to author
Forward
0 new messages