Simple way to access classpath?

36 views
Skip to first unread message

Yang Zhang

unread,
Oct 2, 2011, 10:39:04 PM10/2/11
to simple-b...@googlegroups.com
When this was asked before [1], the answer seems to require a
configuration. How do I access the classpath without any
configuration change? (This was originally a ticket [2].)

[1] https://groups.google.com/forum/#!topic/simple-build-tool/0rhVRPnjyZU
[2] https://github.com/harrah/xsbt/issues/210

--
Yang Zhang
http://yz.mit.edu/

Artyom Olshevskiy

unread,
Oct 2, 2011, 10:47:12 PM10/2/11
to simple-b...@googlegroups.com
You can dump any task output to console using show. In that case full-classpath task is what you want.

> show full-classpath
[info] Updating {file:/home/siasia/projects/test/}default-b69015...
[info] Done updating.
[info] List(Attributed(/home/siasia/projects/test/target/scala-2.9.1/classes), Attributed(/home/siasia/.sbt/boot/scala-2.9.1/lib/scala-library.jar))
[success] Total time: 4 s, completed 03.10.2011 5:45:45

Yang Zhang

unread,
Oct 3, 2011, 2:56:46 PM10/3/11
to simple-b...@googlegroups.com
How do I string them together with colon path separators (without
extra configurations or scripts)?

> --
> 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/-/oDeO9B9djZIJ.
> 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.
>

eugene yokota

unread,
Oct 3, 2011, 3:25:16 PM10/3/11
to simple-b...@googlegroups.com
> set TaskKey[String]("full-classpath-string") <<= (fullClasspath
in Runtime) map { (cp) => cp map {_.data} mkString(";") }
> show full-classpath-string

-eugene

Yang Zhang

unread,
Oct 3, 2011, 3:31:21 PM10/3/11
to simple-b...@googlegroups.com
Any chance of seeing this definition built-in to sbt?

Artyom Olshevskiy

unread,
Oct 4, 2011, 10:51:19 AM10/4/11
to simple-b...@googlegroups.com
Create a plugin for that.
Or submit a ticket to Mark. 
Not very generic, so I'm not sure if he accepts, but you could try.

Yang Zhang

unread,
Oct 4, 2011, 3:17:59 PM10/4/11
to simple-b...@googlegroups.com
FWIW, we've needed it in every sbt project we've had so far, including
a web application, a machine learning featurizer, a scraper, and
various little data processing tools. This has mainly been for
feeding into other Java tools, but also other little things like
creating independent launcher scripts
(http://stackoverflow.com/questions/7134993/how-do-i-run-an-sbt-main-class-from-the-shell-as-normal-command-line-program).
That's why I thought it would be useful to have this built-in.

> --
> 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/-/oQa0fIO4wNkJ.


> 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.
>

--
Yang Zhang
http://yz.mit.edu/

Doug Tangren

unread,
Oct 4, 2011, 3:32:01 PM10/4/11
to simple-b...@googlegroups.com
On Tue, Oct 4, 2011 at 3:17 PM, Yang Zhang <yangha...@gmail.com> wrote:
FWIW, we've needed it in every sbt project we've had so far, including
a web application, a machine learning featurizer, a scraper, and
various little data processing tools.  This has mainly been for
feeding into other Java tools, but also other little things like
creating independent launcher scripts
(http://stackoverflow.com/questions/7134993/how-do-i-run-an-sbt-main-class-from-the-shell-as-normal-command-line-program).
 That's why I thought it would be useful to have this built-in.


Sbt's core built in feature should be focused on how enabling you to build your project and not make assumptions about how you are going to deploy it. There's an open space for plugins in that area.

Check out the assembly plugin, https://github.com/eed3si9n/sbt-assembly, which will package that all up for you so you can  deploy any app essentially anywhere that has a java runtime.

Yang Zhang

unread,
Oct 4, 2011, 3:51:40 PM10/4/11
to simple-b...@googlegroups.com
On Tue, Oct 4, 2011 at 12:32 PM, Doug Tangren <d.ta...@gmail.com> wrote:
> On Tue, Oct 4, 2011 at 3:17 PM, Yang Zhang <yangha...@gmail.com> wrote:
>>
>> FWIW, we've needed it in every sbt project we've had so far, including
>> a web application, a machine learning featurizer, a scraper, and
>> various little data processing tools.  This has mainly been for
>> feeding into other Java tools, but also other little things like
>> creating independent launcher scripts
>>
>> (http://stackoverflow.com/questions/7134993/how-do-i-run-an-sbt-main-class-from-the-shell-as-normal-command-line-program).
>>  That's why I thought it would be useful to have this built-in.
>>
>
> Sbt's core built in feature should be focused on how enabling you to build
> your project and not make assumptions about how you are going to deploy it.
> There's an open space for plugins in that area.

Not really being specific to deployment at all; in fact, I imagine
this is mainly useful throughout the development process. Just
whenever you just want to get the damned classpath in its standard
format without having to go look up and paste in a two-line script or
otherwise modify your project configuration or add a plug-in or what
have you.

>
> Check out the assembly plugin, https://github.com/eed3si9n/sbt-assembly,
> which will package that all up for you so you can  deploy any app
> essentially anywhere that has a java runtime.
>

> --
> You received this message because you are subscribed to the Google Groups
> "simple-build-tool" group.

Reply all
Reply to author
Forward
0 new messages