sbt

How to prevent SBT to include test dependencies into the POM

随声附和 提交于 2021-01-27 00:54:07
问题 I have a small utilities scala build with test classes under a dedicated test folder. Compiling and then publish-local creates the package in my local repository. As expected, the test folder is automatically excluded from the local jar of the utilities package. However, the resulting POM still contains the related dependencies as defined in the sbt. The SBT dependencies: libraryDependencies ++= Seq( "org.scalactic" %% "scalactic" % "3.0.0" % Test, "org.scalatest" %% "scalatest" % "3.0.0" %

In sbt, how can I cross-build with dependencies that are not required in one version?

戏子无情 提交于 2021-01-21 09:41:28
问题 I need to cross-build a project with both Scala 2.10 and 2.11 (and ultimately 2.12 also). Some packages that were part of 2.10, for example parser-combinators, are packaged independently in 2.11. Thus they are not required to be mentioned in the 2.10 build but are required in 2.11. Furthermore, there may be more than one such package, which are required to use a common version. I found the documentation re: cross-building on the SBT site to be somewhat lacking in helpfulness here. And,

How do I link variables inside another object in scaladocs?

倾然丶 夕夏残阳落幕 提交于 2021-01-20 04:28:05
问题 To link another class, I can use [[package.Classname]] . Linking functions defined by def works as well, but trying to link variables doesn't work. What I've tried: object Foo { val BAR = 0 } object Example { /** * Does the thing with [[Foo.BAR]] */ def doTheThing(): Unit = { } } I've also tried [[Foo#BAR]] (from another post) instead of [[Foo.BAR]] , which fails as well. What's the proper way to link variables in scaladoc? 回答1: The right way to go is what you have already tried: /** * Does

“Insecure HTTP request is unsupported” Error in Scala

不打扰是莪最后的温柔 提交于 2021-01-05 08:56:55
问题 I am getting the following error when attempting to run sbt run to run my Scala code: insecure HTTP request is unsupported 'http://repo.typesafe.com/typesafe/releases'; switch to HTTPS or opt-in as ("typesafe-releases" at "http://repo.typesafe.com/typesafe/releases").withAllowInsecureProtocol(true), or by using allowInsecureProtocol in repositories file This is strange because it was working perfectly fine last week and I have changed nothing in the code. I have tried adding ("typesafe

“Insecure HTTP request is unsupported” Error in Scala

半世苍凉 提交于 2021-01-05 08:56:14
问题 I am getting the following error when attempting to run sbt run to run my Scala code: insecure HTTP request is unsupported 'http://repo.typesafe.com/typesafe/releases'; switch to HTTPS or opt-in as ("typesafe-releases" at "http://repo.typesafe.com/typesafe/releases").withAllowInsecureProtocol(true), or by using allowInsecureProtocol in repositories file This is strange because it was working perfectly fine last week and I have changed nothing in the code. I have tried adding ("typesafe

sbt: set specific scalacOptions options when compiling tests

不问归期 提交于 2021-01-02 05:04:50
问题 Normally I use this set of options for compiling Scala code: scalacOptions ++= Seq( "-deprecation", "-encoding", "UTF-8", "-feature", "-unchecked", "-language:higherKinds", "-language:implicitConversions", "-Xfatal-warnings", "-Xlint", "-Yinline-warnings", "-Yno-adapted-args", "-Ywarn-dead-code", "-Ywarn-numeric-widen", "-Ywarn-value-discard", "-Xfuture", "-Ywarn-unused-import" ) But some of them don't play well with ScalaTest, so I would like to disable -Ywarn-dead-code and -Ywarn-value

sbt: set specific scalacOptions options when compiling tests

我是研究僧i 提交于 2021-01-02 05:03:28
问题 Normally I use this set of options for compiling Scala code: scalacOptions ++= Seq( "-deprecation", "-encoding", "UTF-8", "-feature", "-unchecked", "-language:higherKinds", "-language:implicitConversions", "-Xfatal-warnings", "-Xlint", "-Yinline-warnings", "-Yno-adapted-args", "-Ywarn-dead-code", "-Ywarn-numeric-widen", "-Ywarn-value-discard", "-Xfuture", "-Ywarn-unused-import" ) But some of them don't play well with ScalaTest, so I would like to disable -Ywarn-dead-code and -Ywarn-value

sbt assembly: deduplicate module-info.class

拜拜、爱过 提交于 2020-12-29 05:20:13
问题 I get the following error when assembling my uber jar: java.lang.RuntimeException: deduplicate: different file contents found in the following: [error] /Users/jake.stone/.ivy2/cache/org.bouncycastle/bcprov-jdk15on/jars/bcprov-jdk15on-1.61.jar:module-info.class [error] /Users/jake.stone/.ivy2/cache/javax.xml.bind/jaxb-api/jars/jaxb-api-2.3.1.jar:module-info.class I am not up to date with java technology, but assume I cannot simply discard one of these classes. Can someone tell me what

Listing files from resource directory in sbt 1.2.8

六月ゝ 毕业季﹏ 提交于 2020-12-25 08:46:31
问题 I have a Scala application which processes binary files from some directory in resources . I would like to get this directory as java.io.File and list all the contents. In the newest sbt I am unable to do it the straight way. I have created minimal repo with my issue: https://github.com/mat646/sbt-resource-bug The issue does not occur with sbt 0.13.18 and lower. So after some research I've found out that since sbt 1.0 the design has changed and such issue has been already addressed here:

Listing files from resource directory in sbt 1.2.8

a 夏天 提交于 2020-12-25 08:45:00
问题 I have a Scala application which processes binary files from some directory in resources . I would like to get this directory as java.io.File and list all the contents. In the newest sbt I am unable to do it the straight way. I have created minimal repo with my issue: https://github.com/mat646/sbt-resource-bug The issue does not occur with sbt 0.13.18 and lower. So after some research I've found out that since sbt 1.0 the design has changed and such issue has been already addressed here: