sbt-plugin

SBT Plugin: How to add compiler plugin as a dependency that is not propagated downstream?

若如初见. 提交于 2019-12-10 14:48:20
问题 I'm writing a SBT plugin. I would like to use Circe JSON library, but it requires the Macro Paradise compiler plugin on Scala 2.10. Normally you add compiler plugins to build.sbt and SBT plugins to project/plugins.sbt . Now when you're building a SBT plugin, the other plugins become dependencies, so you put them to build.sbt and they are propagated to the projects where you use your SBT plugin. When I put the following snippet in build.sbt of my SBT plugin: addCompilerPlugin("org.scalamacros"

troubleshooting jar loading conflicts in sbt

家住魔仙堡 提交于 2019-12-08 16:35:21
问题 I get the following error on sbt startup, when two specific sbt plugins are added together to a project in its build definition. One of these sbt plugins is scalikejdbc and the other is my own, and clearly their mutual inclusion in a project's build definition results in this error upon sbt startup: scala.reflect.internal.Types$TypeError: package macros contains object and package with same name: blackbox Clearly, it looks as if each plugin brings along a different version of scala.reflect

Unable to run custom sbt task from AutoPlugin's command

我是研究僧i 提交于 2019-12-08 07:22:35
问题 I tried everything I could think of but running taskB still ends up with the error message that task is not defined either in */*:taskB or in */cmd:taskB if I put it in custom configuration. Command.command("doStuff", Help.more("doStuff", "whatever")) { (state: State) => val e = Project.extract(state) val taskA = taskKey[Seq[String]]("A") val taskB = taskKey[Seq[File]]("B") val cmdConfig = config("cmd") val newState = e.append( inConfig(cmdConfig)(Seq( taskA := { // do stuff }, taskB := { //

How to configure sonatype nexus to allow sbt plugins?

♀尐吖头ヾ 提交于 2019-12-07 16:28:51
问题 When publishing our plugin we got this [info] Done packaging. [trace] Stack trace suppressed: run last *:publish for the full output. [error] (*:publish) java.io.IOException: PUT operation to URL https://nexus.mycompany.com/repository/maven-snapshots/com/foo/foo-sbt-plugin_2.10_0.13/1.0.0-SNAPSHOT/foo-sbt-plugin-1.0.0-SNAPSHOT.pom failed with status code 400: Invalid path for a Maven 2 repository We set up the plugin using sbtPlugin := true publishMavenStyle := true 回答1: This was fixed by

Unable to run custom sbt task from AutoPlugin's command

与世无争的帅哥 提交于 2019-12-07 07:30:33
I tried everything I could think of but running taskB still ends up with the error message that task is not defined either in */*:taskB or in */cmd:taskB if I put it in custom configuration. Command.command("doStuff", Help.more("doStuff", "whatever")) { (state: State) => val e = Project.extract(state) val taskA = taskKey[Seq[String]]("A") val taskB = taskKey[Seq[File]]("B") val cmdConfig = config("cmd") val newState = e.append( inConfig(cmdConfig)(Seq( taskA := { // do stuff }, taskB := { // do stuff } ) ) , state ) val result: (State, Seq[File]) = e.runTask(taskB in cmdConfig, newState) )

How to configure sonatype nexus to allow sbt plugins?

爱⌒轻易说出口 提交于 2019-12-06 03:47:10
When publishing our plugin we got this [info] Done packaging. [trace] Stack trace suppressed: run last *:publish for the full output. [error] (*:publish) java.io.IOException: PUT operation to URL https://nexus.mycompany.com/repository/maven-snapshots/com/foo/foo-sbt-plugin_2.10_0.13/1.0.0-SNAPSHOT/foo-sbt-plugin-1.0.0-SNAPSHOT.pom failed with status code 400: Invalid path for a Maven 2 repository We set up the plugin using sbtPlugin := true publishMavenStyle := true This was fixed by setting the repository Layout Policy to permissive in the nexus admin. http://nexus.mycompany.com/#admin

how to prevent gitlab ci from downloading sbt every time?

穿精又带淫゛_ 提交于 2019-12-03 06:10:00
问题 We have a play2/scala application which we are building with gitlab ci. Our .gitlab-ci.yml (at least the important part) looks as follows: image: hseeberger/scala-sbt variables: SBT_GLOBAL_BASE_DIR: "$CI_PROJECT_DIR/cache/.sbt" IVY2_CACHE_DIR: "$CI_PROJECT_DIR/cache/.ivy2" SBT_BOOT_DIR: "$CI_PROJECT_DIR/cache/.sbt/boot" M2_HOME_DIR: "$CI_PROJECT_DIR/cache/.m2" before_script: # Log the sbt version - sbt sbt-version build: stage: build script: - ./build.sh with build.sh : sbt -Dsbt.global.base=

how to prevent gitlab ci from downloading sbt every time?

*爱你&永不变心* 提交于 2019-12-02 19:34:05
We have a play2/scala application which we are building with gitlab ci. Our .gitlab-ci.yml (at least the important part) looks as follows: image: hseeberger/scala-sbt variables: SBT_GLOBAL_BASE_DIR: "$CI_PROJECT_DIR/cache/.sbt" IVY2_CACHE_DIR: "$CI_PROJECT_DIR/cache/.ivy2" SBT_BOOT_DIR: "$CI_PROJECT_DIR/cache/.sbt/boot" M2_HOME_DIR: "$CI_PROJECT_DIR/cache/.m2" before_script: # Log the sbt version - sbt sbt-version build: stage: build script: - ./build.sh with build.sh : sbt -Dsbt.global.base=$SBT_GLOBAL_BASE_DIR \ -Dsbt.ivy.home=$IVY2_CACHE_DIR \ -Dsbt.boot.directory=$SBT_BOOT_DIR \ compile

SBT plugin - User defined configuration for Command via their build.sbt

允我心安 提交于 2019-11-29 12:18:02
I'm writing an SBT Plugin that adds a Command and would like users to be able to configure this Command by setting variables in their build.sbt . What is the simplest way to achieve this? Here is an simplified example of what the Plugin looks like: import sbt.Keys._ import sbt._ object MyPlugin extends Plugin { override lazy val settings = Seq(commands += Command.args("mycommand", "myarg")(myCommand)) def myCommand = (state: State, args: Seq[String]) => { //Logic for command... state } } I would like someone to be able to add the follow to their build.sbt file: newSetting := "light" How do I

SBT plugin - User defined configuration for Command via their build.sbt

泄露秘密 提交于 2019-11-28 06:00:36
问题 I'm writing an SBT Plugin that adds a Command and would like users to be able to configure this Command by setting variables in their build.sbt . What is the simplest way to achieve this? Here is an simplified example of what the Plugin looks like: import sbt.Keys._ import sbt._ object MyPlugin extends Plugin { override lazy val settings = Seq(commands += Command.args("mycommand", "myarg")(myCommand)) def myCommand = (state: State, args: Seq[String]) => { //Logic for command... state } } I