These are chat archives for sbt/sbt
A relaxed chat room about sbt (That interactive build tool). For getting help on sbt, we encourage people to document it on Stackoverflow or subscribing to Lightbend subscription.
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
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
GenerateAvroSchemain the root
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") )
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.