[0.9] Issue with plugins

23 views
Skip to first unread message

Heiko Seeberger

unread,
May 27, 2011, 3:44:09 AM5/27/11
to simple-b...@googlegroups.com
Hi,

When creating a plugin for SBT 0.9, the POM contains a dependency to the exact SBT version, the plugin was created with. An example taken from sbteclipse:

    ...
    <dependencies>
        <dependency>
            <groupId>org.scala-tools.sbt</groupId>
            <artifactId>sbt_2.8.1</artifactId>
            <version>0.9.7</version>
            <scope>compile</scope>
        </dependency>
        ...

This makes it impossible to use it with SBT 0.9.8 or SBT 0.9.9-SNAPSHOT or possibly at all:

[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] ::          UNRESOLVED DEPENDENCIES         ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.scala-tools.sbt#sbt_2.8.1;0.9.7: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::

Question: Would it be possible that the dependency to sbt is omitted?

Heiklo

--

Heiko Seeberger
Twitter: hseeberger
Blog: heikoseeberger.name


Vasil Remeniuk

unread,
May 27, 2011, 3:47:54 AM5/27/11
to simple-b...@googlegroups.com
Hi Heiko,

Same problem here. I have to make cross-builds of sbt-netbeans-plugin for each next version of sbt.

--Vasil

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



--
-----

Twitter: twitter.com/remeniuk
Blog: vasilrem.com
Github: github.com/remeniuk
Scala Enthusiasts Belarus: twitter.com/scalaby

Heiko Seeberger

unread,
May 27, 2011, 4:15:59 AM5/27/11
to simple-b...@googlegroups.com
Looks like you can work around it with this little trick:

pomPostProcess := { (pom: scala.xml.Node) =>
  import scala.xml._
  import scala.xml.transform._
  val rewriteRule = new RewriteRule {
    override def transform(n: Node) = n match {
      case elem @ Elem(_, "dependency", _, _, _*) if ((elem \ "groupId").text == "org.scala-tools.sbt") && ((elem \ "artifactId").text startsWith "sbt_")  => NodeSeq.Empty
      case other => other
    }
  }
  new RuleTransformer(rewriteRule)(pom)
}

Heiko

Mark Harrah

unread,
May 27, 2011, 1:44:52 PM5/27/11
to simple-b...@googlegroups.com
Heiko, Vasil,

It is quite unlikely 0.9.x is going to be binary (or even source) compatible between versions. Because the configuration system is not based on inheritance anymore, it is more likely compatibility can be preserved going forward (i.e. for 0.10.x). However, until there is reliable tooling to detect binary incompatibilities, I would hesitate to use a plugin compiled for one version of sbt with another version.

Previously, plugins were distributed as source so this wasn't a problem. There is still the ability to compile plugins from source using the external projects feature. It would be nicer if there was less configuration overhead to this, but I don't have any ideas on that right now.

-Mark

Heiko Seeberger

unread,
May 27, 2011, 3:39:29 PM5/27/11
to simple-b...@googlegroups.com
Mark,

So we have to publish plugins for each SBT version we want to release, i.e. cross-build plugins. And using a cross-built plugin is not facilitated by something like %% for the Scala cross-builds. Correct?

Heiko

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

Artyom Olshevskiy

unread,
May 27, 2011, 6:02:17 PM5/27/11
to simple-b...@googlegroups.com
But you can always do like I described in my web plugin:
libraryDependencies <<= (libraryDependencies, appConfiguration) {
(deps, app) =>
deps :+ "com.github.siasia" %% "xsbt-web-plugin" % app.provider.id.version
}

Just ensure that the artifacts are built against the version.

Artyom Olshevskiy

unread,
May 27, 2011, 6:45:29 PM5/27/11
to simple-b...@googlegroups.com
And by the way something like following can also be implemented:
"organization" %% "module" %% "version"
where second two percent signs mean append sbt version to module version.

Mark Harrah

unread,
May 27, 2011, 7:22:41 PM5/27/11
to simple-b...@googlegroups.com

I added sbtVersion as a convenience, so you can do:

libraryDependencies <+= sbtVersion( v =>
"com.github.siasia" %% "xsbt-web-plugin" % v
)

-Mark

Mark Harrah

unread,
May 27, 2011, 7:23:16 PM5/27/11
to simple-b...@googlegroups.com
On Fri, 27 May 2011 21:39:29 +0200
Heiko Seeberger <heiko.s...@googlemail.com> wrote:
> Mark,
>
> So we have to publish plugins for each SBT version we want to release, i.e.
> cross-build plugins. And using a cross-built plugin is not facilitated by
> something like %% for the Scala cross-builds. Correct?

I wouldn't worry about cross-building for 0.9.x. There are things we can do to mitigate this problem, but I don't plan on looking at it until after 0.10.0.

-Mark

Reply all
Reply to author
Forward
0 new messages