Configuration problem using twirl standalone

465 views
Skip to first unread message

Pieterjan Vandaele

unread,
Jul 3, 2014, 3:34:55 AM7/3/14
to play-fr...@googlegroups.com
All,

I want to use twirl in a non-play project. I use Build.scala (so no build.sbt), and try to set it up so the project compiles the twirl templates in the "src/main/twirl" directory.

Currently I have:

...
import play.twirl.sbt.SbtTwirl
import play.twirl.sbt.Import.TwirlKeys._
...

object Scalabuild extends Build {
...

  val sharedSettings = baseSettings ++ buildSettings ++ publishSettings ++ unidocSettings ++ scoverageSettings ++ coverallsSettings ++ assemblySettings ++ SbtTwirl.twirlSettings ++ Seq(
    libraryDependencies ++= (testDeps ++ commonDeps),
    resolvers ++= commonResolvers,
    scalacOptions ++= Seq("-encoding", "utf8"),
    scalacOptions += "-unchecked",
    scalacOptions += "-deprecation",
    scalacOptions += "-feature",
    scalacOptions += "-Yresolve-term-conflict:package",
    javacOptions ++= Seq("-source", buildJvmVersion, "-target", buildJvmVersion),
    javacOptions in doc := Seq("-source", buildJvmVersion),
    parallelExecution in Test := true
  )

  lazy val inquiryMailer = Project(
    id = buildName,
    base = file("."),
    settings = sharedSettings
  ).enablePlugins(SbtTwirl)

}

But I run into the following upon running sbt:

References to undefined settings: 

  *:sourceGenerators from *:sourceGenerators ((play.twirl.sbt.SbtTwirl) SbtTwirl.scala:54)

     Did you mean compile:sourceGenerators ?

  *:configuration from *:twirlCompileTemplates::target ((play.twirl.sbt.SbtTwirl) SbtTwirl.scala:50)

     Did you mean compile:configuration ?

  *:managedSourceDirectories from *:managedSourceDirectories ((play.twirl.sbt.SbtTwirl) SbtTwirl.scala:55)

     Did you mean scalaunidoc:managedSourceDirectories ?


Anyone with more experience able to help out? much appreciated!

Best regards,
pjan



Peter Vlugter

unread,
Jul 3, 2014, 6:19:12 PM7/3/14
to play-framework
Hi,

Remove the use of `SbtTwirl.twirlSettings`. You should only need `enablePlugins(SbtTwirl)`.

If only enabling the plugin is not working, then make sure you don't have sbt's defaultSettings in your baseSettings. If you do, the defaultSettings will be added twice, and the second time will override some of the twirl plugin settings.

Peter
> --
> You received this message because you are subscribed to the Google Groups "play-framework" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Pieterjan Vandaele

unread,
Jul 3, 2014, 9:09:17 PM7/3/14
to play-fr...@googlegroups.com
Thank you so much Peter,

both mistakes on my part:

1) I removed the use of SbtTwirl.twirlSettings now

2) I had sbt defaultSettings in my baseSettings.

-> removing both solved all the issues.

+1 for the Typesafe team (again :-))

Saeed Zarinfam

unread,
Jan 11, 2017, 5:03:03 AM1/11/17
to Play Framework
You can visit this example project.
Reply all
Reply to author
Forward
0 new messages