Search code examples
sbtbintray

Sbt for publish in bintray


I have the next configuration:

lazy val mainProject = Project(
    id = "project-helper",
    base = file("."),
    settings = Project.defaultSettings ++ Seq(
      name := "my-first-project",
      version := "0.1-SNAPSHOT",
      scalaVersion := "2.10.2",
      licenses += ("MIT", url("http://opensource.org/licenses/MIT")),
      publishMavenStyle := false,
      pomExtra := pomXml,
      publishArtifact in Test := false,
      resolvers += "Typesafe Releases" at "http://repo.typesafe.com/typesafe/releases",
      libraryDependencies ++= Seq(
        "org.scala-lang"    %  "scala-reflect"   % "2.10.3",
        "org.scalamacros"   %  "quasiquotes_2.10.3" % "2.0.0-M3"
      ),
      addCompilerPlugin("org.scalamacros" % "paradise" % "2.0.0-M3" cross CrossVersion.full)
    )
  )

I want publish this into a bintray.

I do publish but i got error:

    java.lang.RuntimeException: Repository for publishing is not specified.
at scala.sys.package$.error(package.scala:27)
at sbt.Classpaths$$anonfun$getPublishTo$1.apply(Defaults.scala:1203)
at sbt.Classpaths$$anonfun$getPublishTo$1.apply(Defaults.scala:1203)
at scala.Option.getOrElse(Option.scala:120)

I use a bintray-sbt plugin.

Thanks


Solution

  • See the README:

    Publishing

    To publish a package to bintray, you need a bintray account. You can do so here. After creating a bintray account you can add

    seq(bintrayPublishSettings:_*)
    

    You likely need something like this.

    import bintray.Plugin._
    
    lazy val mainProject = Project(id = "project-helper", base = file(".")).
      settings(bintrayPublishSettings: _*).
      settings(
        name := "my-first-project",
        version := "0.1-SNAPSHOT",
        scalaVersion := "2.10.2",
        licenses += ("MIT", url("http://opensource.org/licenses/MIT")),
        publishMavenStyle := false,
        pomExtra := pomXml,
        publishArtifact in Test := false,
        resolvers += "Typesafe Releases" at "http://repo.typesafe.com/typesafe/releases",
        libraryDependencies ++= Seq(
          "org.scala-lang"    %  "scala-reflect"   % "2.10.3",
          "org.scalamacros"   %  "quasiquotes_2.10.3" % "2.0.0-M3"
        ),
        addCompilerPlugin("org.scalamacros" % "paradise" % "2.0.0-M3" cross CrossVersion.full)
      )