Global plugin as source nor working #594

Closed
hseeberger opened this Issue Nov 9, 2012 · 3 comments

Comments

Projects
None yet
2 participants
@hseeberger
Member

hseeberger commented Nov 9, 2012

The docs (http://www.scala-sbt.org/release/docs/Extending/Plugins.html) say that one can define a global plugin as source:
A Plugin may be directly defined in Scala source files in ~/.sbt/plugins/, such as ~/.sbt/plugins/MyPlugin.scala. ~/.sbt/plugins/build.sbt should contain sbtPlugin := true.

That is not working. Interestingly using ~/.sbt/plugins/project/MyPlugin.scala, which would make more sense in my opinion, also won't work.

@harrah

This comment has been minimized.

Show comment Hide comment
@harrah

harrah Nov 9, 2012

Owner

Need reproducible test case as discussed on mailing list.

Owner

harrah commented Nov 9, 2012

Need reproducible test case as discussed on mailing list.

@harrah harrah closed this Nov 9, 2012

@hseeberger

This comment has been minimized.

Show comment Hide comment
@hseeberger

hseeberger Nov 9, 2012

Member

Providing the required information below. Please reopen.

Content of ~/.sbt-0.12/plugins/Util.scala:

package heiko

import sbt._

object SbtUtil extends Plugin {

  def typesafeInternal(isSnapshot: Boolean) = {
    val qualifier = if (isSnapshot) "snapshots" else "releases"
    Some(Resolver.url(
      "typesafe-internal-maven-%s" format qualifier,
      new java.net.URL("http://repo.typesafe.com/typesafe/internal-maven-%s/" format qualifier)
    ))
  }
}

Content of ~/.sbt-0.12/plugins/plugins.sbt:


addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0")

addSbtPlugin("name.heikoseeberger.sbt.groll" % "sbt-groll" % "1.4.0")

sbtPlugin := true

Content of Build.scala of the project using the plugin:

import sbt._
import sbt.Keys._
import com.typesafe.sbt.SbtScalariform._
import heiko.SbtUtil._
...

Error message on loading sbt project:

[info] Loading global plugins from /Users/heiko/.sbt-0.12/plugins
[info] Compiling 1 Scala source to /Users/heiko/.sbt-0.12/plugins/target/scala-2.9.2/sbt-0.12/classes...
[info] Loading project definition from /Users/heiko/projects/deckgen/project
[info] Compiling 1 Scala source to /Users/heiko/projects/deckgen/project/target/scala-2.9.2/sbt-0.12/classes...
[error] /Users/heiko/projects/deckgen/project/Build.scala:4: not found: object heiko
[error] import heiko.SbtUtil._
Member

hseeberger commented Nov 9, 2012

Providing the required information below. Please reopen.

Content of ~/.sbt-0.12/plugins/Util.scala:

package heiko

import sbt._

object SbtUtil extends Plugin {

  def typesafeInternal(isSnapshot: Boolean) = {
    val qualifier = if (isSnapshot) "snapshots" else "releases"
    Some(Resolver.url(
      "typesafe-internal-maven-%s" format qualifier,
      new java.net.URL("http://repo.typesafe.com/typesafe/internal-maven-%s/" format qualifier)
    ))
  }
}

Content of ~/.sbt-0.12/plugins/plugins.sbt:


addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0")

addSbtPlugin("name.heikoseeberger.sbt.groll" % "sbt-groll" % "1.4.0")

sbtPlugin := true

Content of Build.scala of the project using the plugin:

import sbt._
import sbt.Keys._
import com.typesafe.sbt.SbtScalariform._
import heiko.SbtUtil._
...

Error message on loading sbt project:

[info] Loading global plugins from /Users/heiko/.sbt-0.12/plugins
[info] Compiling 1 Scala source to /Users/heiko/.sbt-0.12/plugins/target/scala-2.9.2/sbt-0.12/classes...
[info] Loading project definition from /Users/heiko/projects/deckgen/project
[info] Compiling 1 Scala source to /Users/heiko/projects/deckgen/project/target/scala-2.9.2/sbt-0.12/classes...
[error] /Users/heiko/projects/deckgen/project/Build.scala:4: not found: object heiko
[error] import heiko.SbtUtil._

@harrah harrah reopened this Nov 9, 2012

@harrah

This comment has been minimized.

Show comment Hide comment
@harrah

harrah Nov 9, 2012

Owner

Thanks, confirmed.

Owner

harrah commented Nov 9, 2012

Thanks, confirmed.

@ghost ghost assigned harrah Nov 9, 2012

harrah added a commit that referenced this issue Nov 11, 2012

@harrah harrah closed this in 9bf5405 Nov 11, 2012

harrah added a commit that referenced this issue Dec 13, 2012

harrah added a commit that referenced this issue Dec 13, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment