Re: [sbt] Renaming the compile task?

83 views
Skip to first unread message

Mark Harrah

unread,
Oct 11, 2012, 10:17:47 PM10/11/12
to simple-b...@googlegroups.com
Hi Dave,

On Thu, 11 Oct 2012 13:00:16 -0700 (PDT)
David Glidden <david....@meraki.net> wrote:

> Hello,
>
> I am trying to incorporate a side-effect of 'sbt compile' which will dump
> the full classpath to a file. Unfortunately, the full-classpath task
> already depends on the compile task, so the side-effect results in a cyclic
> dependency. I can obviously just write a new task further down the
> dependency chain, but I don't want other developers I'm working with to
> remember to use this task instead of 'sbt compile'. Is there a way to
> rename the original compile task so the new task I write can be invoked
> with 'sbt compile'?

yourTask <<= fullClasspath map { ... } triggeredBy(compile in Compile)

This will schedule `yourTask` to run whenever the main `compile` task runs.

Note that you can get everything but the compiled class directory from `dependencyClasspath`.

-Mark

> Thanks,
>
> -Dave
>
> --
> You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/simple-build-tool/-/0WM4XPazR34J.
> 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.
>

David Glidden

unread,
Oct 12, 2012, 1:43:12 PM10/12/12
to simple-b...@googlegroups.com
Thanks Mark! This is exactly what I was looking for. Such an easy fix.

-Dave
Reply all
Reply to author
Forward
0 new messages