How to publish-local to my local maven repo (~/.m2/repository)?

4,103 views
Skip to first unread message

Christos KK Loverdos

unread,
Jan 21, 2011, 9:53:33 AM1/21/11
to simple-b...@googlegroups.com
Hi all,

Is there a standard recipe for this?

I am using some scala code built by sbt as a dependency on another java project build by maven, so I want to take advantage of my cached local maven repo.

Thanks
-- CKKL

Doug Tangren

unread,
Jan 21, 2011, 10:11:41 AM1/21/11
to simple-b...@googlegroups.com
If you are publishing locally and want to push to your m2 dir, add the following to your project/build/FooProject.scala file


override def managedStyle = ManagedStyle.Maven
 lazy val publishTo = Resolver.file("your local repo", new java.io.File("path/to/m2/repo"))

Viktor Klang came up with a pretty sweet trick [1] that uses dropbox if you are sharing with others and don't have a hosted maven repo


When you run the `publish` sbt action this should publish your versioned jar there.


-Doug Tangren
http://lessis.me



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


Christos KK Loverdos

unread,
Jan 21, 2011, 10:17:10 AM1/21/11
to simple-b...@googlegroups.com
FYI

I just tried maven-sbt

https://github.com/codahale/maven-sbt

and it is great, but I was wondering if there could be some specific configuration to be placed in my project definition.

-- CKKL

--
__~O
-\ <, Christos KK Loverdos
(*)/ (*) http://ckkloverdos.com


Indrajit Raychaudhuri

unread,
Jan 23, 2011, 8:12:03 AM1/23/11
to simple-b...@googlegroups.com
I find this to be convenient:

lazy val publishRemote = propertyOptional[Boolean](false, true)

val local = Resolver.file("Local", Path.userHome / ".m2" / "repository"
asFile)
val remote = "Remote" at "http://somewhere.com/repo"

override def defaultPublishRepository =
if (!publishRemote.value) Some(local) else Some(remote)


Thus:

"sbt 'set publish.remote false' publish" // goes to local
"sbt 'set publish.remote true' publish" // goes to remote

You can use the system property to switch too :)

- Indrajit

Christos KK Loverdos

unread,
Jan 27, 2011, 6:41:39 AM1/27/11
to simple-b...@googlegroups.com
Indrajit, Doug,

Many thanx for your answers.

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

--

Jakub Liska

unread,
Apr 22, 2014, 2:13:54 PM4/22/14
to simple-b...@googlegroups.com
publish-m2

Brian Topping

unread,
Apr 26, 2014, 2:03:07 PM4/26/14
to simple-b...@googlegroups.com
On Tuesday, April 22, 2014 11:13:54 AM UTC-7, Jakub Liska wrote:
publish-m2

This was only added on more recent versions of SBT.  This thread was started over three years ago. :)
Reply all
Reply to author
Forward
0 new messages