These are chat archives for sbt/sbt

31st
Jul 2017
Rob Norris
@tpolecat
Jul 31 03:52
How do I set up travis such that sbt-release can sign artifacts for me?
How do I set up travis such that sbt-release can push tags to github for me?
How is this not in red bold flashing text in every attempted explanation of how to do this?
Jeffrey Olchovy
@jeffreyolchovy
Jul 31 07:10

for those of you looking for an alternative to giter8 for use with sbt new, i just published a new plugin+resolver that can leverage apache freemarker templates. sbt-fmpp-resolver

this was largely an experiment -- please see the usage and motivation section of the README.md for more details -- but i think it is more or less a success so far. the integration was rather simple (started saturday, finished sunday night), and it hooks into the FMPP front-end which exposes every last feature of freemarker. it is way more powerful than i had anticipated (full support for user defined macros, conditionals, loops, etc.)...

since this was a brand new plugin, i targeted both sbt 0.13 and 1.0 .. getting this right (with a rather complicated project structure) took most of my time. i have more details in the README.md about this too, but i'll be opening up some issues in the sbt repo once i pare down the examples that cause these issues/defects.

if there is significant interest in using this as an alternative to giter8, i will prepare an official release (feedback and contributions are very much welcome). i think giter8 works for most of my use cases for project archetypes and scaffolding .. but sometimes i really would like to be able to define a udf or do some conditional branching.. this plugin+resolver allows you to do that

@tpolecat enable the CrossPerProjectPlugin on https://github.com/tpolecat/doobie/blob/infra/build.sbt#L131-L158
Rob Norris
@tpolecat
Jul 31 07:19
I'll try that, thanks. It wasn't clear where it needed to be enabled.
Dale Wijnand
@dwijnand
Jul 31 07:21
@milessabin there's a community plugins page in the 1.x docs
N.S. Cutler
@godenji
Jul 31 12:56
Not sure how well supported cross plugins are in IntelliJ, a sea of red in Eclipse due to inability to mix scala 2.10/2.12 and sbt 0.13/1.0. Guess it's back to VIM for plugin projects until sbt 0.13 can be dropped.
mariop-da
@mariop-da
Jul 31 13:56
ehi folks, is there a roadmap to support autoplugins written in scala 2.12? I have a couple of projects that don't support scala 2.10 and I need to make sbt plugin depending on them
Dale Wijnand
@dwijnand
Jul 31 14:01
yes, in sbt 1
mariop-da
@mariop-da
Jul 31 14:03
thanks @dwijnand
Tomczik76
@Tomczik76
Jul 31 16:03
Hey every one, I'm trying to run multiple projects but when I run the project it can't find my main class
lazy val avro: Project = Project(
  "avro",
  file(".avro"),
  settings =  Seq(
    description := "Scio REPL for dj-dna-etl",
    libraryDependencies ++= Seq(
      "org.apache.avro" % "avro" % "1.8.2"
    ),
    mainClass in Compile := Some("com.dowjones.dna.etl.avro.GenerateAvroSchema")
   )
)
sbt avro/run
[warn] Executing in batch mode.
[warn]   For better performance, hit [ENTER] to switch to interactive mode, or
[warn]   consider launching sbt without any commands, or explicitly passing 'shell'
[info] Loading global plugins from /Users/developer/.sbt/0.13/plugins
[info] Loading project definition from /Users/developer/Dev/dj-dna-etl/project
[info] Set current project to dj-dna-etl (in build file:/Users/developer/Dev/dj-dna-etl/)
[info] Running com.dowjones.dna.etl.avro.GenerateAvroSchema 
[error] (run-main-0) java.lang.ClassNotFoundException: com.dowjones.dna.etl.avro.GenerateAvroSchema
java.lang.ClassNotFoundException: com.dowjones.dna.etl.avro.GenerateAvroSchema
        at java.lang.ClassLoader.findClass(ClassLoader.java:530)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[trace] Stack trace suppressed: run last avro/compile:run for the full output.
java.lang.RuntimeException: Nonzero exit code: 1
        at scala.sys.package$.error(package.scala:27)
[trace] Stack trace suppressed: run last avro/compile:run for the full output.
[error] (avro/compile:run) Nonzero exit code: 1
[error] Total time: 0 s, completed Jul 31, 2017 11:02:24 AM
any thoughts?
Dale Wijnand
@dwijnand
Jul 31 16:07
Where is the main class and what does it look like?
Tomczik76
@Tomczik76
Jul 31 16:07
it is in the right location
it's an Object with a main method
correct package name
so adding
.dependsOn(
root
)
fixed my problem
but what I'm trying to do is run this project first to generate sources that my main project needs
Dale Wijnand
@dwijnand
Jul 31 16:12
sounds like you put GenerateAvroSchema in the root src/main/scala instead of .avro/src/main/scala
Tomczik76
@Tomczik76
Jul 31 16:12
oh
so should I do something like
```
lazy val avro: Project = Project(
  "avro",
  file("./src/com/dowjones/dna/etl/avro"),
  settings =  commonSettings ++ noPublishSettings ++  Seq(
    description := "Generate Avro",
    libraryDependencies ++= Seq(
      "org.apache.avro" % "avro" % "1.8.2"
    ),
    mainClass in Compile := Some("com.dowjones.dna.etl.avro.GenerateAvroSchema")
   )
or do I move that code into a folder called avro?
Dale Wijnand
@dwijnand
Jul 31 16:16
move the code to the avro subproject
if it's the only main, then you won't even have to declare it with mainClass
OlegYch
@OlegYch
Jul 31 16:22
file("./src/com/dowjones/dna/etl/avro") is rather unusual
Tomczik76
@Tomczik76
Jul 31 16:27
should I put the code under avro/main/scala?
I got it
thanks!
Tomczik76
@Tomczik76
Jul 31 17:38
Is there a way to print out the Settings for a particular project
southrivers
@southrivers
Jul 31 18:49
Is there any way I could use maven repository?
Not the Ivy
mariop-da
@mariop-da
Jul 31 20:00
@dwijnand another question: is it possible to have a multi-module sbt project where one of the sub-modules is an sbt plugin and another sub-module wants to use that sbt plugin. It's clear that dependsOn doesn't work because it doesn't work for the build settings. I found this but it's very old and has the issue that the sbt plugin must be self-contained to work in this way
Tomczik76
@Tomczik76
Jul 31 21:11
Hey does anyone know if there is a way to have a Task use the generated sources of a sub project?
N.S. Cutler
@godenji
Jul 31 22:20

Assume that scripted works out of the box for 0.13/1.0 cross builds, but am getting an odd error when running 2.12 phase of tests (2.10 tests pass without issue):

[info] Error during sbt execution: Could not finder sbt launch configuration.  Searched classpath for:
[info]     /sbt.boot.propertiesUnspecified
[info]     /sbt/sbt.boot.propertiesUnspecified
[info]     /sbt.boot.properties
[info]     /sbt/sbt.boot.properties

Is there some special setup work required for scripted to work with scala 2.12? Test directories live in src/sbt-test/project-name/ if that helps.

0.13.16 and 1.0.0-RC3