softprops / coffeescripted-sbt

pour some coffee for scala
MIT License
55 stars 5 forks source link

README instructions not working, can't find jcoffeescript #1

Closed yang closed 13 years ago

yang commented 13 years ago

I'm seeing the following when I add the lines to my project/plugins/build.sbt:

[warn]  module not found: org.jcoffeescript#jcoffeescript;1.1

Any ideas? Using xsbt 0.10.1 and scala 2.9.0.1, if that matters.

softprops commented 13 years ago

Thanks for pointing this out. I'm seeing it now after I cleaned jcoffeescript out of my ivy cache. I'll look into it. Thanks for reporting it

softprops commented 13 years ago

There seems to be some inconsistency between how sbt resolves library dependencies between an update request from the source of the plugin and and update of the client of the plugin. See this gist. A client of a plugin skips resolving artifacts declared with the from attribute. I use this because I don't think the author of jcoffeescript publishes his library to a repo. Anyway, the underlying issue here looks like a bug in sbt. I'll try to track it down in sbt's source and post to the sbt list if I can't find anything.

In the meantime, you can git clone git://github.com/softprops/coffeescripted-sbt.git && cd coffeescripted-sbt && yoursbtscript publish-local if you want to get sbt to download jcoffeescript as expected. That will get it in your ivy cache where your other project can resolve it.

Sorry for the hassle!

softprops commented 13 years ago

Arg! This is apparently no longer supported for plugins in newer versions of sbt 1.

In the meantime add the following line to your librarySettings to get this to work

"org.jcoffeescript" % "jcoffeescript" % "1.1" from "http://cloud.github.com/downloads/yeungda/jcoffeescript/jcoffeescript-1.1.jar"

I'll update the readme and try to get that author to publish his library to an actual repo

yang commented 13 years ago

Thanks for the explanation. I still appear to be seeing issues with the new instructions:

$ cat project/plugins/build.sbt 
resolvers += "less is" at "http://repo.lessis.me"

libraryDependencies <++= sbtVersion(v => Seq(
   "me.lessis" %% "coffeescripted-sbt" % "0.1.2-%s".format(v),
   "org.jcoffeescript" % "jcoffeescript" % "1.1" from "http://cloud.github.com/downloads/yeungda/jcoffeescript/jcoffeescript-1.1.jar"
))

$ sbt
[info] Set current project to default-933f25 (in build file:/tmp/proj/project/plugins/)
[info] Updating {file:/tmp/proj/project/plugins/}default-933f25...
[info] Done updating.
[info] Set current project to default-ac4bf7 (in build file:/tmp/proj/)
> coffee
[error] Not a valid command: coffee
[error] Not a valid project ID: coffee
[error] Not a valid configuration: coffee
[error] Not a valid key: coffee (similar: offline, log-buffered)
[error] coffee
[error]       ^
daggerrz commented 13 years ago

Doug, if you want to remove the dependency, check out https://github.com/daggerrz/scala-coffee. If slapped it together a couple of weeks back and should do the trick. It might be less inefficient that jcoffee as it doesn't cache the context between compiles, but I a) don't think it will matter much and b) that should be a quick fix (that I don't have time for right now :)).

Feel free to copy / rip out whatever you want from it and drop a dependency!

softprops commented 13 years ago

@yang: arg! this is so frustrating. sry about the hassle. There are still some things that haven't been thought all the way through in how sbt handles plugins in 0.10. I talked to the maintainer of jcoffeescript and he submitted a request to get it published on maven central so I could depend on like a normal mvn project.

@daggerrz: cool! do you think you were going to publish that? I didn't really look at how jcoffeescript works but I took a quick look at yours and I think it does the same. Just ship some text off to rhino with the coffeescript compiler. Cool stuff.

daggerrz commented 13 years ago

I thought you'd just paste the one class into your plugin source tree and make you dependency free. :)

softprops commented 13 years ago

fixed in 0.1.3 http://implicit.ly/coffeescripted-sbt-013

yang commented 13 years ago

Thanks for the update - sadly, I am still not able to access any coffee commands:

$ sbt
[info] Set current project to default-e472e6 (in build file:/home/yang/pod/sales/scala/project/plugins/)
[info] Set current project to default-cd6fd7 (in build file:/home/yang/pod/sales/scala/)
> coffee
[error] Not a valid command: coffee
[error] Not a valid project ID: coffee
[error] Not a valid configuration: coffee
[error] Not a valid key: coffee (similar: offline, log-buffered)
[error] coffee
[error]       ^
> coffee:bare
[error] Not a valid key: coffee (similar: offline, log-buffered)
[error] coffee:bare
[error]       ^
> coffee<TAB>
{invalid input}
softprops commented 13 years ago

you should get something like

coffee: bare clean clean-files coffee configuration source-directory sources streams target-directory

one thing to note is that this plugin, like many others don't mix in their settings by default now, as a best practice.

Add this to your project's main build.sbt file

seq(coffeescript.CoffeeScript.coffeeSettings: _*)

I updated the readme 1 with this. Also, you can use this g8 template 2 as a reference

yang commented 13 years ago

Thanks! That works now.

softprops commented 13 years ago

great to hear!