Question

I'm trying to publish a project into my local repository with sbt.

This is my build.sbt file

name := "myProject"

organization := "co.myorganization"

version := "2.0"

scalaVersion := "2.11.0"

sbtPlugin := true

This is my publishLocal command output:

[info] :: delivering :: co.myorganization#myProject;2.0 :: 2.0 :: release :: Thu May 15 14:57:24 COT 2014

All seems to work fine but in my other project I'm getting this error when I try to use it as a dependency like so:

"co.myorganization" % "my-project"  % "2.0"

Error output:

::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: co.myorganization#my-project;2.0: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[trace] Stack trace suppressed: run last *:update for the full output.
[error] (*:update) sbt.ResolveException: unresolved dependency: co.s4n#s4n-autenticacion;2.0: not found
[error] Missing task key: scalaInstance
java.lang.IllegalArgumentException
    at org.sbtidea.Settings.logErrorAndFail(Settings.scala:11)
    at org.sbtidea.Settings$$anonfun$task$1.apply(Settings.scala:24)
    at org.sbtidea.Settings$$anonfun$task$1.apply(Settings.scala:24)
    at scala.Option.getOrElse(Option.scala:120)
    at org.sbtidea.Settings.task(Settings.scala:24)
    at org.sbtidea.SbtIdeaPlugin$.projectData(SbtIdeaPlugin.scala:163)
    at org.sbtidea.SbtIdeaPlugin$$anonfun$2.applyOrElse(SbtIdeaPlugin.scala:88)
    at org.sbtidea.SbtIdeaPlugin$$anonfun$2.applyOrElse(SbtIdeaPlugin.scala:87)
    at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:33)
    at scala.collection.TraversableLike$$anonfun$collect$1.apply(TraversableLike.scala:278)
    at scala.collection.immutable.RedBlackTree$.foreach(RedBlackTree.scala:79)
    at scala.collection.immutable.TreeMap.foreach(TreeMap.scala:202)
    at scala.collection.TraversableLike$class.collect(TraversableLike.scala:278)
    at scala.collection.immutable.TreeMap.collect(TreeMap.scala:48)
    at org.sbtidea.SbtIdeaPlugin$.doCommand(SbtIdeaPlugin.scala:87)
    at org.sbtidea.SbtIdeaPlugin$$anonfun$org$sbtidea$SbtIdeaPlugin$$ideaCommand$2.apply(SbtIdeaPlugin.scala:45)
    at org.sbtidea.SbtIdeaPlugin$$anonfun$org$sbtidea$SbtIdeaPlugin$$ideaCommand$2.apply(SbtIdeaPlugin.scala:45)
    at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:60)
    at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:60)
    at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:62)
    at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:62)
    at sbt.Command$.process(Command.scala:95)
    at sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:100)
    at sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:100)
    at sbt.State$$anon$1.process(State.scala:179)
    at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:100)
    at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:100)
    at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
    at sbt.MainLoop$.next(MainLoop.scala:100)
    at sbt.MainLoop$.run(MainLoop.scala:93)
    at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:71)
    at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:66)
    at sbt.Using.apply(Using.scala:25)
    at sbt.MainLoop$.runWithNewLog(MainLoop.scala:66)
    at sbt.MainLoop$.runAndClearLast(MainLoop.scala:49)
    at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:33)
    at sbt.MainLoop$.runLogged(MainLoop.scala:25)
    at sbt.StandardMain$.runManaged(Main.scala:57)
    at sbt.xMain.run(Main.scala:29)
    at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:57)
    at xsbt.boot.Launch$.withContextLoader(Launch.scala:77)
    at xsbt.boot.Launch$.run(Launch.scala:57)
    at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:45)
    at xsbt.boot.Launch$.launch(Launch.scala:65)
    at xsbt.boot.Launch$.apply(Launch.scala:16)
    at xsbt.boot.Boot$.runImpl(Boot.scala:32)
    at xsbt.boot.Boot$.main(Boot.scala:21)
    at xsbt.boot.Boot.main(Boot.scala)
[error] java.lang.IllegalArgumentException

Please advise.

Was it helpful?

Solution

If you build the project as plugin sbtPlugin := true it will add an extra information about the sbt version.

You have to add these kind of artefacts with addSbtPlugin, additionally because you've overridden default Scala version for the plugin you'd have to add it to the addSbtPlugin method:

addSbtPlugin("co.myorganization" % "myproject" % "2.0", "0.13", "2.11")

assuming that you want to add your plugin to Sbt version 0.13 and Scala 2.11.

When doing plugins better stick with default version of Scala.

If your intention is not to have a plugin remove sbtPlugin := true from your build.sbt.

OTHER TIPS

Perhaps you need to add your local repository to the resolvers list?

resolvers += "Local Maven Repository" at file(
    Path.userHome.absolutePath+"/.m2/repository").toURL.toString
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top