scala-json icon indicating copy to clipboard operation
scala-json copied to clipboard

Some build and dependency instructions / publishing in a repository somewhere

Open mjwillson opened this issue 16 years ago • 5 comments

Hey there

If I want to depend on this from a scala project, what's the best way to do it?

Is it published in a repository anywhere? or do I need to build and push to a local repository? (The build system I'm using, scala's simple-build-tool, seems to look for dependencies in a default local ivy repository at ~/.ivy2 - I tried 'ant package' and 'ant push' to publish here, but didn't do what I wanted... the latter fails with "unknown resolver push")

Anyway some basic instructions in the README would be great, especially for us rubyists looking into scala, who're still getting used to the java toolchain...

Cheers muchly

mjwillson avatar Nov 11 '09 19:11 mjwillson

How we do it internally is to build the package as a jar via ant and copy the jar into the enclosing project's libs directory. sbt has support for this, IIRC.

We don't think this is the most awesome way to handle it but find dealing with an external maven repo to be a huge pain.

stevej avatar Nov 11 '09 19:11 stevej

OK, cheers for the help.

I figured I could probably fall back on that approach if needs be, just wasn't sure if it was the "right way" / if you had an official twitter repo somewhere.

Think I found out how to get it to push to my default local ivy repo though, which means I can just add

val json = "com.twitter" % "json" % "1.1"

to my sbt build. I added this to your ivysettings.xml after looking at http://www.jaya.free.fr/ivy/doc/tutorial/defaultconf.html

<property name="ivy.local.default.root"            value="${ivy.default.ivy.user.dir}/local" override="false"/>
<property name="ivy.local.default.ivy.pattern"      value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" override="false"/>
<property name="ivy.local.default.artifact.pattern" value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]" override="false"/>

and within resolvers:

<filesystem name="push">
  <ivy pattern="${ivy.local.default.root}/${ivy.local.default.ivy.pattern}" />
  <artifact pattern="${ivy.local.default.root}/${ivy.local.default.artifact.pattern}" />
</filesystem>

again dunno if this is the 'right' way but worked for me

Cheers

mjwillson avatar Nov 11 '09 19:11 mjwillson

(and then 'ant push' did what i wanted)

can push this as a commit if you think it looks useful / correct...

mjwillson avatar Nov 11 '09 19:11 mjwillson

yeah, please push that commit and send me a pull request and I'm happy to apply it.

stevej avatar Nov 11 '09 19:11 stevej

Cool, although now suspect I'm not doing it quite the right way... perhaps this ought to replace the current config for 'local' resolver, and have a 'publish-local' task or something. Just looking at http://ant.apache.org/ivy/history/2.1.0-rc1/tutorial/multiproject.html

mjwillson avatar Nov 11 '09 20:11 mjwillson