scala - Using a custom sbt plugin -


I have created a new Scala project and have written AutoPlugin below in a Src / Main / scala / com / company / plugin directory and related namespace The plugin code is a cut and paste from [1] to helloplugin 3 , although I have changed the names.

Then, in a second SBT project, I have included my new Hello World plugin in the project / plugins.sbt file. This other project has other 'Business Code'. When I run the SBT in that second project, the plugin is resolved and I have tested that by removing the jar from ~ / .ivy / local / ... and then the project Complain about loading and witnessing of SBT that this plugin can not be found when I redo the publishLocal my plugin project, the error is removed.

So I'm glad that the plugin has been solved and the jar file is not empty because I have checked its content.

However, when I have a sbt> About My custom plugins are not listed and the command I was expecting to be available is not that. ("[Error] is not a valid order: hello"). But other plugin I list in plugins.sbt (io.spray sbt-revolver) is visible in the output.

Both plugins are specified in the project and the second project scalaVersion: = "2.10.3" in their build.sbt files.

I am using SBT 0.13.6. Interesting, and perhaps related, the SBT command plugins is apparently not valid in this project, however this plugin works well in the project.

What extra steps are I making to make the command available for my second project?

For convenience, the plugin code is below, but as mentioned, it is a copy from the link below it. package com.company.plugin import sbt._ Expanding import keys._Object helplagin autoplugin {Object auto-import {val greet = settingKey [string] ("greeting")} import Auto Import._ Override DTT Trigger = AllRequirements Override the idle val buildSettings = Seq (greeting: = "Hello", Command + = Halo Command) Lazy Vale Halo Command = Command.com ("Hello") {(State: State) = & gt; Println ("fred")}

Edit:

build.sbt for the plugin project is as follows; Organization: = "com.company" name: = "name" version: "0.0.1-SNAPSHOT" / Pre>

The only file I created in this project is the own for the .scala file plugin.

[1]

The project trying to use the plugin Finished with project / build.properties This file sets the SBT version to 0.13.1 , for some reasons my plugins and sbt plugins are called for the command to not work < P> Changing the value to 0.13.6 causes all problems to go away.

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -