Overriding the unmanaged jars task

213 views
Skip to first unread message

Maurício Linhares

unread,
Feb 19, 2012, 2:35:27 PM2/19/12
to simple-b...@googlegroups.com
Hello guys,

This is my first time around here and I'm a newbie on SBT. I have a
project that has two different directories with unmanaged jars, using
SBT, i can easily define the "unmanagedBase" to one of these
directories, but I would need to do it on both folders.

The SBT documentation tells me to override the "unmanagedJars" task,
but I have been unsuccessful at that, any hints are very much
appreciated. Keep in mind I'm using the **.scala** build definition
and NOT the **.sbt** file.

Here's what I have done so far -> https://gist.github.com/1865332

-
Maurício Linhares
http://techbot.me/ - http://twitter.com/#!/mauriciojr

Eugene Vigdorchik

unread,
Feb 19, 2012, 3:14:21 PM2/19/12
to simple-b...@googlegroups.com
2012/2/19 Maurício Linhares <linhares...@gmail.com>:

> Hello guys,
>
> This is my first time around here and I'm a newbie on SBT. I have a
> project that has two different directories with unmanaged jars, using
> SBT, i can easily define the "unmanagedBase" to one of these
> directories, but I would need to do it on both folders.
>
> The SBT documentation tells me to override the "unmanagedJars" task,
> but I have been unsuccessful at that, any hints are very much
> appreciated. Keep in mind I'm using the **.scala** build definition
> and NOT the **.sbt** file.
>
> Here's what I have done so far -> https://gist.github.com/1865332
What you have should work if 'custom_libs' and 'executables' are
located in the root of your build.
What is the actual location of those directories?

Cheers,
Eugene.

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

Maurício Linhares

unread,
Feb 19, 2012, 7:55:15 PM2/19/12
to simple-b...@googlegroups.com
Here's a sample project showing how it doesn't work ->
https://github.com/mauricio/sbt-with-many-unmanaged-repos

sbt compile

And you will see it isn't able to compile as it isn't seeing the jar files.

Eugene Vigdorchik

unread,
Feb 20, 2012, 3:54:31 AM2/20/12
to simple-b...@googlegroups.com
2012/2/20 Maurício Linhares <mauricio...@gmail.com>:

> Here's a sample project showing how it doesn't work ->
> https://github.com/mauricio/sbt-with-many-unmanaged-repos
>
> sbt compile
>
> And you will see it isn't able to compile as it isn't seeing the jar files.
Ok, the problem is that you place 'unmanagedJars' initialization
outside of settings.
So the following works for me:
settings(
....
unmanagedJars := {
Dependencies.listUnmanaged( file(".").getAbsoluteFile )
}
)

Remember that when you initialize (with ":=" in your case) you don't
assign to a variable, but rather compute the Setting object that needs
to be put in project's settings.

Maurício Linhares

unread,
Feb 20, 2012, 9:12:32 AM2/20/12
to simple-b...@googlegroups.com
Thanks Eugene,

I've made progress with your hint, now if I run:

sbt show unmanaged-tasks

It correctly lists all jars. But when I run:

sbt compile

The project still doesn't compile. Do I need to do something specific
to get it to compile correctly?

Eugene Vigdorchik

unread,
Feb 20, 2012, 9:32:53 AM2/20/12
to simple-b...@googlegroups.com
2012/2/20 Maurício Linhares <mauricio...@gmail.com>:

> Thanks Eugene,
>
> I've made progress with your hint, now if I run:
>
> sbt show unmanaged-tasks
>
> It correctly lists all jars. But when I run:
>
> sbt compile
>
> The project still doesn't compile. Do I need to do something specific
> to get it to compile correctly?
Does it help if you modify your setting to

unmanagedJars in Compile := {

Maurício Linhares

unread,
Feb 20, 2012, 9:45:17 AM2/20/12
to simple-b...@googlegroups.com
That did it!

Can I assume Compile also includes Runtime and Test?

BTW, if you have an SO account, you can answer in there to grab some
points - http://stackoverflow.com/q/9346489/293686

On Mon, Feb 20, 2012 at 11:32 AM, Eugene Vigdorchik

Reply all
Reply to author
Forward
0 new messages