Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jun 22 2015 11:10
    japgolly commented #2066
  • Jun 22 2015 08:25
    keepscoding commented #2044
  • Jun 21 2015 03:24
    xerial commented #157
  • Jun 21 2015 00:10
    eed3si9n unlabeled #2057
  • Jun 21 2015 00:10

    eed3si9n on 0.13

    Adds bundledLauncherProj to all… Remove launcher tests Add unit tests to Travis and 3 more (compare)

  • Jun 21 2015 00:10
    eed3si9n closed #2057
  • Jun 21 2015 00:10

    eed3si9n on fixbuild

    (compare)

  • Jun 20 2015 18:42
    eed3si9n synchronize #2057
  • Jun 20 2015 18:42

    eed3si9n on fixbuild

    Fix typo (compare)

  • Jun 20 2015 18:23

    eed3si9n on fixbuild

    Adds bundledLauncherProj to all… Remove launcher tests Add unit tests to Travis and 1 more (compare)

  • Jun 20 2015 18:23
    eed3si9n synchronize #2057
  • Jun 20 2015 14:59

    eed3si9n on scalaversionbump

    (compare)

  • Jun 20 2015 14:59

    eed3si9n on 0.13

    Bumping up Scala version to 2.1… Try to keep bincompat Fixes #1666 and 1 more (compare)

  • Jun 20 2015 14:59
    eed3si9n unlabeled #2068
  • Jun 20 2015 14:59
    eed3si9n closed #2068
  • Jun 20 2015 14:59
    eed3si9n closed #1666
  • Jun 20 2015 14:57
    eed3si9n commented #2068
  • Jun 20 2015 12:55
    dwijnand commented #2068
  • Jun 20 2015 04:51
    eed3si9n synchronize #2068
  • Jun 20 2015 04:51

    eed3si9n on scalaversionbump

    Fixes #1666 (compare)

Jean-Luc Deprez
@spangaer
you did trigger the submodule init right?
Nestor10
@Nestor10
from the project root, it does nothing if I navigate to the (.sbt/staging/zzzzzzzzz/projectRef) i can execute the init and then it loads. The problem is that manual step
Jean-Luc Deprez
@spangaer
well, if the including project is a git project, you can include the referenced projects as a submodule there and then use file based references to the other project
then you can init any nested submodule by recursive submodule init
I've used plenty of projectrefs, but never to a git url
etienne
@crakjie
I just realized sbt --client does not support multi commands in the same way that sbt classic.
Do anyone know how to run sbt --client with multiple commands?
etienne
@crakjie
it's not very pretty but we can do it like this sbt 'clean; pullRemoteCache; compile'
Veyis Turgut
@veyisTurgut

Hi, I get a weird error while trying to build my sbt project. Here is the error -- I googled it, but no answer:
"""
[info] started sbt server
sbt:system_agent>
;set root.sala.olletion.Seq(historyPath := None,shellPrompt := { _ => "" }
No such widget ' ,SettingKey[_root_.sala.Option[_root_.sbt.File] No such widget']
No such widget '("sbtStrutureOutputFile") No such widget'
in root.sbt.Global := root.sala.Some(root.sbt.file("/private/var/folders/hd/3y3ws16374yx_5tph6jt800000gp/T/sbt-struture.xml")
No such widget ' ) No such widget'
,SettingKey[root.java.lang.String]
No such widget ' ("sbtStrutureOptions") No such widget' in root.sbt.Global := "download, resolveClassifiers")
No such widget `'

<set>:1: error: object sala is not a member of package <root>
root.sala.olletion.Seq(historyPath := None,shellPrompt := { _ => "" },SettingKeyroot.sala.Option[root.sbt.File] in root.sbt.Global := root.sala.Some(root.sbt.file("/private/var/folders/hd/3y3ws16374yx_5tph6jt800000gp/T/sbt-struture.xml")),SettingKeyroot.java.lang.String in root.sbt.Global := "download, resolveClassifiers")
^

<set>:1: error: object sala is not a member of package <root>
root.sala.olletion.Seq(historyPath := None,shellPrompt := { _ => "" },SettingKeyroot.sala.Option[root.sbt.File] in root.sbt.Global := root.sala.Some(root.sbt.file("/private/var/folders/hd/3y3ws16374yx_5tph6jt800000gp/T/sbt-struture.xml")),SettingKeyroot.java.lang.String in root.sbt.Global := "download, resolveClassifiers")
^

<set>:1: error: object sala is not a member of package <root>
root.sala.olletion.Seq(historyPath := None,shellPrompt := { _ => "" },SettingKeyroot.sala.Option[root.sbt.File] in root.sbt.Global := root.sala.Some(root.sbt.file("/private/var/folders/hd/3y3ws16374yx_5tph6jt800000gp/T/sbt-struture.xml")),SettingKeyroot.java.lang.String in root.sbt.Global := "download, resolveClassifiers")
^
[error] Type error in expression
sbt:system_agent>
[info] shutting down sbt server
"""

'c' character is removed from the command as you may see from above, "scala.collection" became "sala.olletion".
Any ideas?
Ps: I use Apple M1 Macbook Air, sbt version: 1.5.5, jdk version: 1.8 temurin

David Hoyt
@davidhoyt
Am using 1.6.2. I have a project which depends on a project of sbt plugins (and uses them for its own build). the version does not propagate to the sbt plugins project. would appreciate any help in getting this to work. :D When I release it, I want the plugin artifact to have the same version as the repo (they release together basically).
Matt Dziuban
@mrdziuban
hey everyone, I'm trying to use watchOnTermination to run some code after a task prefixed with ~ is stopped with enter, but my code isn't being hit. is this the correct way to use watchOnTermination?
ThisBuild / watchOnTermination := { (action, cmd, times, state) =>
  println(s"action: $action, cmd: $cmd, times: $times, state: $state")
  state
}
ollijh
@liff:matrix.org
[m]
what’s the application name to use for sbt in an $if in .inputrc?
Jonas Amundsen
@badeball
Is anyone else frequently seeing java.io.IOException: Resource deadlock would occur upon sbt --client pullRemoteCache ?
This is in a CI environment where multiple processes may be doing exactly that
Laurynas Tretjakovas
@n3ziniuka5
I am trying to remove a resource from the sbt stage build result. I tried using (Compile / packageBin / mappings) ~= to modify the mappings and it works. The problem is that the resource is also removed when doing sbt run and that's undesired. Universal / mappings operates at a higher level and doesn't allow to exclude resource files from individual jars. Any suggestions?
Anirudh Vyas
@AnirudhVyas
hi there i have a question for dependency with reference.conf files - I need to be able to exclude those reference files from library which are dependencies - how do I do exclusions for those?
Mark de Jong
@Fristi
Is there a way to get libraryDependencies from a ResolvedProject ?
Command.command("test") { s =>
    val extracted: Extracted = Project extract s
    val currentBuildUri: URI = extracted.currentRef.build
    val buildStructure = extracted.structure
    val buildUnitsMap = buildStructure.units
    val currentBuildUnit           = buildUnitsMap(currentBuildUri)
    val projectsMap: Map[String, ResolvedProject] = currentBuildUnit.defined
    val projects: Seq[ResolvedProject] = projectsMap.values.toVector
    val projectsNodes: Seq[DependencyGraphNode[ResolvedProject]] = projects map { p =>
      DependencyGraphNode.create(p, projectsMap)
    }

    s
  }
Per project I would like to get the libraryDependencies
Mark de Jong
@Fristi
Found it:
val data = buildStructure.data
val deps = buildStructure.allProjectRefs.flatMap { p =>

      for {
        name <- (p / name).get(data)
        deps <- (p / libraryDependencies).get(data)
        scalaVersion <- (p / scalaVersion).get(data)
        scalaBinaryVersion <- (p / scalaBinaryVersion).get(data)

      } yield ???
    }
onsoup42
@onsoup42

When publishing is it possible to set properties on the containing folder?
I can set properties on all the files that are published like this:

publishTo := Some(s"https://url.to.artifactroy;timestamp=${timestamp};git.hash=${hash}")

But I want to set those properties on the folder containing these files in artifactory. Is this something I can configure SBT to do?

techstack2022
@techstack2022
How to create and save value in cookie and retrieve the value via Javascript?
mvillafuertem
@mvillafuertem
Hi all, is there any way to run a custom task before running the test task. I am trying with this configuration but it gives me some errors. what is wrong with this configuration? Thanks
lazy val `myProject` = (project in file("myProject"))
  .settings {
    val myTask     = taskKey[Unit]("myTask")
    myTask := {
      val log = streams.value.log
      log.warn("myTask")
    }
    test := (test dependsOn myTask).value
  }
[error] References to undefined settings: 
[error] 
[error]   myProject / test from myProject / test (/scala/build.sbt:279)
[error]      Did you mean myProject / assemblyPackageDependency / test ?
[error] 
[error]   myProject / myTask from myProject / test (/scala/build.sbt:279)
[error]  
[error] Use 'last' for the full log.
Daniele Riccardelli
@tehzhed

Hey all!

I am wondering if there’s some nice resources on how to leverage sbt remote cache in both local and CI builds.

For example, one thing that puzzles me is the need to explicitly execute pullRemoteCache before compilation, and pushRemoteCache afterwards.

As it is, this requires users to remember about and deliberate execute cache pulls and pushes.
Off the top of my head, what I can think of is defining a custom task - e.g. rcompile - that runs pull, compile and push in order.
Otherwise, what is the suggested way seamlessly integrate the cache into local workflows, if any? Or is this feature better suited to CI’s?

Thanks! :)

Joesan
@joesan

I have a project where I'm having several Object that contains the main function. I would like to package several JAR out of this project where each JAR contains only certain packages. For example., here is my src folder contents:

src
  main
    scala
      com.myproject
        package1
          SomeClass1.scala
        package2
          SomeClass2.scala
        package3
          SomeClass3.scala
        package4
          SomeClass4.scala

Now what I want to do is to run several SBT commands where I can specify some command line arguments that would then exclude either package1 or package2 and so on.

I understand that I could so so with some filtering like below, but how do I combine the command line argument to check which package I should exclude?

// Filter when packaging
excludeFilter in (Compile, unmanagedSources) ~= { _ ||
  ((f: File) =>
    f.getPath.containsSlice("/package1/"))
}
unmanagedSources / excludeFilter := "Main.scala"

So I would like to check the command line argument to build.sbt and use that to exclude the respective packages all-together. Any inputs on how I could do this?

Here is what I tried, but does not work as expected:

import complete.DefaultParsers._
val kfp = inputKey[Unit]("A demo input task.")
kfp := {
  // get the result of parsing
  val args: Seq[String] = spaceDelimited("<arg>").parsed
  // Here, we also use the value of the `scalaVersion` setting
  println("The current Scala version is " + scalaVersion.value)
  println("The arguments to demo were:")
  args foreach println
  if (args(0) == "package1")
  // Filter when packaging
    excludeFilter in (Compile, unmanagedSources) ~= { _ ||
      ((f: File) =>
        f.getPath.containsSlice("/package2/"))
    }
  else if (args(0) == "package2")
    // Filter when packaging
    excludeFilter in (Compile, unmanagedSources) ~= { _ ||
      ((f: File) =>
        f.getPath.containsSlice("/package3/"))
    }
  else if (args(0) == "package3")
  // Filter when packaging
    excludeFilter in (Compile, unmanagedSources) ~= { _ ||
      ((f: File) =>
        f.getPath.containsSlice("/package4/"))
    }
  else
    // Filter when packaging
    excludeFilter in (Compile, unmanagedSources) ~= { _ ||
      ((f: File) =>
        f.getPath.containsSlice("/package1/"))
    }
}

Call it like

sbt package "kfp package1"

Sathya R
@sathyarr
Hi, I have some .xml files under src/main/java
while running sbt package, how can I pack them into jar file?
The directory structure of the files should resemble the java package names
Ángel Cervera Claudio
@angelcervera
move it to the src/main/resources folder
45 replies
Sathya R
@sathyarr
image.png
Tobias Roeser
@tobiasroeser:matrix.org
[m]
Hi. Classic scalac only compiles Scala sources, but reads Java sources as well, to resolve references to them. Is there some way in Zinc, to not compile Java file given as sources?
My background: I want the actual compilation of the files to be done by an other Java compiler, namely AspectJ.
But I need to let Zinc see the Java files, to resolve references to them
eikek
@eikek:matrix.org
[m]
Hi all, I'm facing a problem when evaluating an input task Compile / run inside another task. I'm using (Compile / run).toTask(" args here") - and whenever I try to interpolate the stirng going into toTask, sbt fails with a large stack trace and java.lang.IllegalArgumentException: Could not find proxy for val templateOut: java.io.File in List(value te mplateOut, method $anonfun$website$20, value website, object $cac3cdfc72199802ed7e, package <empty>, packag e <root>) (currentOwner= value website ) - any ideas what I'm doing wrong? (sbt 1.6.2)
Justin Nichols
@justinnichols
Anyone happen to run into issues where sbt will not attempt to download any dependencies when using an M1 Mac? And if so, would you have a possible solution?
Justin Nichols
@justinnichols
Nevermind, seems this comment helped solve the issue we were having: https://github.com/sbt/sbt/issues/6162#issuecomment-733173924
strygul
@strygul
Why can Sbt complain that it cannot find maven-metadata.xml while it exists? What should I look at?
Adding the full error message:
[error] (update) sbt.librarymanagement.ResolveException: Error downloading com.dixa:analytics-thrift-protocol:latest.integration [error] No latest integration version found in [error] No latest integration version found in [error] not found: /Users/strygul/.ivy2/localcom.dixa/analytics-thrift-protocol [error] not found: https://repo1.maven.org/maven2/com/dixa/analytics-thrift-protocol/maven-metadata.xml [error] not found: https://repo.dixa.io/content/repositories/snapshots/com/dixa/analytics-thrift-protocol/maven-metadata.xml
Jonas Amundsen
@badeball
I'm trying to run sbtn on a new machine, but it fails with very little information:
# sbt --client -debug startServer
[addSbt] arg = '-debug'
[residual] arg = 'startServer'
[sbt_options] declare -a sbt_options=()
[debug] running native client
# Executing command line:
/usr/local/sbt/bin/sbtn-x86_64-pc-linux
--sbt-script=/usr/local/bin/sbt
-debug
startServer

May 19, 2022 2:45:39 PM org.jline.utils.Log logr
WARNING: Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)
[info] entering *experimental* thin client - BEEP WHIRR
[info] server was not detected. starting an instance
[error] failed to connect to server
Anyone seen similar?
The warning about system terminal is present on machines where it does work
Jonas Amundsen
@badeball
Is there a way to enable more debug logging?
If it's any help: I'm running sbtn inside a container, which works on one machine, but not another (yes, same container image)
Jonas Amundsen
@badeball
Ouf, it turned out to be due to some corporate tracing utility which ensured LD_PRELOAD was set inside every container, messing with pretty much everything
Magicliang
@magicliang
how can i set system property inside a sbt settings?

i try to define a funtion, and call this function like this:

```

setSysProp("otel.traces.sampler.arg", "1"),
    javaAgents += JavaAgent("io.opentelemetry.javaagent" % "opentelemetry-javaagent" % "1.14.0" % "runtime")
error: type mismatch;
 found   : String
 required: sbt.Def.SettingsDefinition
    setSysProp("otel.traces.sampler", "parentbased_traceidratio"),
and I got compilor error
nafg
@nafg
@magicliang it's better not to set system properties inside a running JVM but anyway, to do side effects in a way you control it should be part of a task
If you want it to run on startup there's some way to add it to the init process but I don't remember the exact way
Magicliang
@magicliang

Thanks for replying. I have a shared start.sh as bootstrap script which is used by a legay building system. I know in pure shell script we can do whatever we want to control the system properties. But I have to decouple this init process from other applications which are using that script, so I can't pollute that script and I can't get rid of it(I don't have a chance to use another script, wtf).

The only option for me is to control system properties in my sbt script, because I need that system properties before javaagent is attached.

Sakib Hadžiavdić
@sake92
Does anyone know what giter8's sbt plugin tests do? I couldnt figure out what it does by default.
Are custom tests supported?