Giter Site home page Giter Site logo

twirl's Issues

TwirlCompiler fails to lookup scala-*.jar on Windows 2003

Hi,

There's a bug in the Play framework template compiler, that causes it to fail to properly lookup scala-library.jar and scala-compiler.jar.
The corresponding ticket for @playframework is ticket-944 in their issue tracker. The fix is planned for Play 2.1.1.
(The ticket title mentions Windows XP, but that's a type and should be Windows 2003.)
You can find the fix in my fork of Play20 in this commit, which applies to TemplateCompiler in Twirl as well.

Our build server runs on Windows 2003, and I already have to maintain an internal fork of Play20, which works as expected with the aforementioned fix.

Best regards

example not working

I cloned the repository, published it locally, went into example directory and issued: sbt run

twirl-compile: java.lang.NoClassDefFoundError: twirl/compiler/TemplateCompilationError

Support includes

Currently twirl does not support includes, as like the Play documentation:

Again, there’s nothing special here. You can just call any other template you like (and in fact any other function coming from anywhere at all):

Home

@common.sideBar()

ivy.xml contains wrong sbt version and wrong scala version

[info] Resolving cc.spray#sbt-twirl;0.5.2 ...
[error] sbt-plugin-releases: bad sbtVersion found in http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/cc.spray/sbt-twirl/scala_2.9.2/sbt_0.12/0.5.2/ivys/ivy.xml: expected='0.12' found='0.11.3'
[error] sbt-plugin-releases: bad scalaVersion found in http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/cc.spray/sbt-twirl/scala_2.9.2/sbt_0.12/0.5.2/ivys/ivy.xml: expected='2.9.2' found='2.9.1'
[error] sbt-plugin-releases: bad sbtVersion found in http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/cc.spray/sbt-twirl/scala_2.9.2/sbt_0.12/0.5.2/ivys/ivy.xml: expected='0.12' found='0.11.3'
[error] sbt-plugin-releases: bad scalaVersion found in http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/cc.spray/sbt-twirl/scala_2.9.2/sbt_0.12/0.5.2/ivys/ivy.xml: expected='2.9.2' found='2.9.1'

sbt 0.13

it would be great, if sbt.013 would be supported :-)

Twirl.settings breaks scala.collection.JavaConversions.mapAsScalaMap in Spring Application Context

I've got an old Scala app I'm slowing converting over to SBT. It still has some Spring 3 stuff in it (yea I know, I know. I will rip it out soon) and I have one thing in my application context that looks like so:

    <bean id="convertersAsScalaMap" class="scala.collection.JavaConversions" factory-method="mapAsScalaMap">
    <constructor-arg ref="converters"/>
</bean>

The trouble is, when I add Twirl.settings to the bottom of my build.sbt, my entire application breaks. I see this in my logs coming from Spring:

 Cannot resolve reference to bean 'convertersAsScalaMap' while setting bean property 'converters'; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [scala.collection.JavaConversions] for bean with name 'convertersAsScalaMap' defined in class path resource [io/bigsense/spring/spring.xml]; nested exception is java.lang.ClassNotFoundException: scala.collection.JavaConversions

I've narrowed it down to the Twirl.settings. If I comment it out, I can't use templates of course, but I no longer see this exception from calling the same set of beans. I'm on sbt 0.13.0 and Scala 2.10.3. My sbt-twirl plugin in 0.7.0.

Does the twirl plugin do something weird that makes JavaConversions inaccessible? I'd really like to use the Play2 template engine to replace my old JSPs.

Here is the source code: https://github.com/sumdog/BigSense/ (Revision 7431e80 and the one right before it on the reengineering branch)

NoSuchElementException during twirl compilation

There's a bug that existed in Play where the template compiler throws a NoSuchElement exception when trying to access the left projection of an Either$RightProjection. A fix was pulled into Play 2.0, and I'd like to port it to twirl.

The stack trace looks like this:

java.util.NoSuchElementException: Either.left.value on Right
    at scala.Either$LeftProjection.get(Either.scala:287)
    at twirl.compiler.TwirlCompiler$TemplateAsFunctionCompiler$TreeCreationMethods$class.treeFrom(TwirlCompiler.scala:638)
    at twirl.compiler.TwirlCompiler$TemplateAsFunctionCompiler$PresentationCompiler$.treeFrom(TwirlCompiler.scala:645)
    at twirl.compiler.TwirlCompiler$TemplateAsFunctionCompiler$TreeCreationMethods$class.treeFrom(TwirlCompiler.scala:623)
    at twirl.compiler.TwirlCompiler$TemplateAsFunctionCompiler$PresentationCompiler$.treeFrom(TwirlCompiler.scala:645)
    at twirl.compiler.TwirlCompiler$TemplateAsFunctionCompiler$.getFunctionMapping(TwirlCompiler.scala:549)
    at twirl.compiler.TwirlCompiler$.generateFinalTemplate(TwirlCompiler.scala:488)
    at twirl.compiler.TwirlCompiler$.compile(TwirlCompiler.scala:186)
    at twirl.sbt.TemplateCompiler$$anonfun$compile$3.apply(TemplateCompiler.scala:46)
    at twirl.sbt.TemplateCompiler$$anonfun$compile$3.apply(TemplateCompiler.scala:44)
    at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:60)
    at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)
    at twirl.sbt.TemplateCompiler$.compile(TemplateCompiler.scala:44)
    at twirl.sbt.TwirlPlugin$Twirl$$anonfun$settings$4.apply(TwirlPlugin.scala:50)
    at twirl.sbt.TwirlPlugin$Twirl$$anonfun$settings$4.apply(TwirlPlugin.scala:50)
etc

References:
Play 2.0 bug report - for some reason it was never resolved
Play 2.0 github pull request - this has a fix
[Google Search](scala.tools.nsc.interactive.FreshRunReq play) - many reports of the same issue

Support for scala v2.10

Hi

We're unable to use the Twirl plugin. I get the following error:
Unresolved dependencies: io.spray#twirl-api_2.10;0.6.2

I have tried to go back to an earlier version:
libraryDependencies += sbtPluginExtra(
m = "io.spray" % "sbt-twirl" % "0.6.2", // Plugin module name and version
sbtV = "0.12", // SBT version
scalaV = "2.9.2" // Scala version compiled the plugin
)

Still no dice. Could you please release a 2.10 build into repos?

sbt.ResolveException: unresolved dependency: com.typesafe.akka#akka-actor;2.0.1: not found

I'm trying to build the example in Arch Linux, and I have sbt 0.12.0

I've tried with tags v0.6.0, v0.6.1, and master, all having the same issue when I launch sbt in the example directory:

sbt.ResolveException: unresolved dependency: com.typesafe.akka#akka-actor;2.0.1: not found
at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:214)
at sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:122)
at sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:121)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:114)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:114)
at sbt.IvySbt$$anonfun$withIvy$1.apply(Ivy.scala:102)
at sbt.IvySbt.liftedTree1$1(Ivy.scala:49)
at sbt.IvySbt.action$1(Ivy.scala:49)
at sbt.IvySbt$$anon$3.call(Ivy.scala:58)
at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:75)
at xsbt.boot.Locks$GlobalLock.withChannelRetries$1(Locks.scala:58)
at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:79)
at xsbt.boot.Using$.withResource(Using.scala:11)
at xsbt.boot.Using$.apply(Using.scala:10)
at xsbt.boot.Locks$GlobalLock.liftedTree1$1(Locks.scala:51)
at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:51)
at xsbt.boot.Locks$.apply0(Locks.scala:30)
at xsbt.boot.Locks$.apply(Locks.scala:27)
at sbt.IvySbt.withDefaultLogger(Ivy.scala:58)

It seems akka-actor-2.0.1 is quite old, and couldn't be found in maven repo.

Is there a specific way of building the example that I don't know of?

Using twirl in integration tests

I'm trying to use twirl as part of my integration tests.

My integration tests have an HTTP simplicator that mimics a real world service. To implement this simplicator in the tests, I'm using spray-can embedded HTTP server which needs to spit out responses based on twirl templates.

My tests are located at /src/it/scala so naturally I want to place these twirl templates inside /src/it/twirl. This doesn't work since the twirl compiler ignores this directory.

If I place the twirl templates in /src/main/twirl, everything works fine - but I'm trying to avoid this because I don't want these templates to clutter the production package (the templates only come into play in the tests so they should only compile inside when the tests are run).

How can I tell the twirl compiler to look for templates in the new directory?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.