Developing plugin via external project reference

43 views
Skip to first unread message

benmccann

unread,
Aug 17, 2012, 3:06:16 AM8/17/12
to simple-b...@googlegroups.com
Hi,

I'm trying to figure out how to create an sbt plugin.  The plugins wiki page suggested using an external project reference.  I have my plugin in a class named com.benmccann.sbtplovr.SbtPlovrPlugin.  If I make any reference to that class in the main project's build file then the project does not load saying that it can't find com.benmccann.  If I remove the reference then I see it print out a line "Loading project definition from /home/bmccann/src/sbt-plovr/project".  Is it impossible to reference classes from an external project in the main project's build file?  Or am I just doing something wrong here?

Thanks,
Ben

Mark Harrah

unread,
Aug 17, 2012, 5:48:31 PM8/17/12
to simple-b...@googlegroups.com
Hi Ben,

On Fri, 17 Aug 2012 00:06:16 -0700 (PDT)
benmccann <benjamin...@gmail.com> wrote:

> Hi,
>
> I'm trying to figure out how to create an sbt plugin. The plugins wiki page<https://github.com/harrah/xsbt/wiki/Plugins>suggested using an external project reference. I have my plugin in a class
> named com.benmccann.sbtplovr.SbtPlovrPlugin. If I make any reference to
> that class in the main project's build file then the project does not load
> saying that it can't find com.benmccann. If I remove the reference then I
> see it print out a line "Loading project definition from
> /home/bmccann/src/sbt-plovr/project". Is it impossible to reference
> classes from an external project in the main project's build file? Or am I
> just doing something wrong here?

It is likely you have declared the external dependency in project/Build.scala. This will only make the classes available to your project sources (in src/main/scala for example).

Plugin external dependencies need to go in project/project/Build.scala, the build definition for your build definition. It is known that this is not ideal, but at least it is possible.

-Mark

> Thanks,
> Ben
>
> --
> You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/simple-build-tool/-/uwNSyc1IhakJ.
> 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.
>

Ben McCann

unread,
Aug 17, 2012, 5:54:23 PM8/17/12
to simple-b...@googlegroups.com
Ah, thanks for the clarification!  This is exactly what I did and I knew it was wrong, but overlooked the extra "project" in the docs.  I was able to make a lot of progress just going the publish-local route in the meantime.

Thanks!
-Ben
Reply all
Reply to author
Forward
0 new messages