title: Building Custom SBT plugin, getting error: object sbt is not a member of package com.typesafe
body: <p><strong>tl;dr</strong> I'm trying to have my custom plugin a) automatically pull the GitVersioning plugin with it, and b) have access to variables such as <code>git.baseVersion</code>. Doing it the best way I know how is giving me import errors.</p>
  
  <p>I am trying to write a custom plugin, similar to the <a href="https://engineering.sharethrough.com/blog/2015/09/23/capturing-common-config-with-an-sbt-parent-plugin/" rel="nofollow">one here</a>. </p>
  
  <p>My <code>BaseSettingsPlugin.scala</code> looks like:</p>
  
  <pre><code>package com.sp.sbt
  
  import sbt.Keys._
  import com.typesafe.sbt.GitVersioning
  import sbt._
  
  
  /**
   * Provides base settings for all of our projects
   */
  object BaseSettingsPlugin extends AutoPlugin {
  
  /**
   * Defines all settings/tasks that get automatically imported,
   * when the plugin is enabled
   */
    object autoImport {
      lazy val libraryVersions = settingKey[Map[Symbol, String]]("Common versions to be used for dependencies")
    }
  
    import autoImport._
  
    // allow the plug-in to be included automatically
    override def trigger: PluginTrigger = allRequirements
  
    override def requires = GitVersioning
  
    /**
     * Provide default settings
     */
    override def projectSettings: Seq[Setting[_]] = Seq(
      scalaVersion := "2.11.7",
  
      organization := "com.sp",
  
      libraryVersions := Map(
        'bijection          -&gt;            "0.8.1",
        'elastic4s          -&gt;            "1.7.4",
        'ficus              -&gt;            "1.1.2",
        'finatra            -&gt;            "2.1.0",
        'hikari             -&gt;            "2.4.1",
        'h2                 -&gt;            "1.4.189",
        'mysql              -&gt;            "5.1.36",
        'redis              -&gt;            "6.29.0",
        'scala              -&gt;            scalaVersion.value,
        'scalatest          -&gt;            "2.2.3",
        'scoverage          -&gt;            "1.1.1",
        'slick              -&gt;            "3.1.1",
        'slickJoda          -&gt;            "2.1.0",
        'specs2             -&gt;            "2.3.13",
        'swagger            -&gt;            "0.3.0",
        'typesafe           -&gt;            "1.3.0"
      )
    )
  }
  </code></pre>
  
  <p>When I try to build my custom plugin, I get the following error message:</p>
  
  <pre><code>[error] BaseSettingsPlugin.scala:10: object sbt is not a member of package com.typesafe
  [error] import com.typesafe.sbt.GitVersioning
  [error]                     ^
  [error] BaseSettingsPlugin.scala:40: not found: value GitVersioning
  [error]   override def requires = GitVersioning
  </code></pre>
  
  <p>The second error message is to be expected, because of the failing import statement.</p>
  
  <p>If I move the <code>import com.typesafe.sbt.GitVersioning</code> to my <code>build.sbt</code> file, I no longer receive the import error, but I do continue to receive the second (not found) error.</p>
  
  <p>What I'm really trying to do is make it so that I can have the following code block in my custom plugin:</p>
  
  <pre><code>git.useGitDescribe := true, // if this is true, then it uses the version number suggested by $&gt; git describe
    // if this is false, it combines the baseVersion and the commit hash of the current commit
  git.baseVersion := "0.0.0",
  git.gitUncommittedChanges := false,
  git.gitTagToVersionNumber := {
    case VersionRegex(v,"") =&gt; Some(v)
    case VersionRegex(v,"SNAPSHOT") =&gt; Some(s"$v-SNAPSHOT")
    case VersionRegex(v,s) =&gt; Some(s"$v-$s-SNAPSHOT")
    case _ =&gt; None
  </code></pre>
  
  <p>}</p>
  
  <p>Also, for clarification, here's <code>build.sbt</code></p>
  
  <pre><code>// we hide the existing definition for setReleaseVersion to replace it with our own
  import sbtrelease.ReleaseStateTransformations.{setReleaseVersion=&gt;_,_}
  import com.typesafe.sbt.GitVersioning
  
  sbtPlugin := true
  
  scalaVersion := "2.10.4"            // This overrides the scalaVersion from BaseSettingsPlugin
  
  name := "base-settings"
  
  libraryDependencies &lt;++= libraryVersions { v =&gt; Seq(
    "org.scala-lang" % "scala-compiler" % v('scala),
    "org.scala-lang" % "scala-library" % v('scala),
    "com.typesafe" % "config" % v('typesafe)
  )}
  
  lazy val root = project
    .in(file("."))
    .enablePlugins(GitVersioning)
    .settings(packageSettings: _*)
  </code></pre>