Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException when trying to build with rules_twirl #34

Open
Srikrishna31 opened this issue Dec 8, 2020 · 2 comments
Open

NullPointerException when trying to build with rules_twirl #34

Srikrishna31 opened this issue Dec 8, 2020 · 2 comments

Comments

@Srikrishna31
Copy link

This issue is continuation of #32
After upgrading the version, I have a new problem.

bazel build :App
INFO: Analyzed target //:App (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /home/l-8296/github_projects/scala_play/app/BUILD:40:1: Compiling twirl template failed (Exit 1): compiler-cli failed: error executing command 
  (cd /home/l-8296/.cache/bazel/_bazel_l-8296/76d33ba2f8986abe556e65dc46b40a5c/execroot/__main__ && \
  exec env - \
  bazel-out/host/bin/external/io_bazel_rules_twirl/compiler-cli/compiler-cli @bazel-out/k8-fastbuild/bin/app/gen/twirl-templates/app/src/main/scala/views/main.html.scala-0.params)
Execution platform: @local_config_platform//:host
java.lang.NullPointerException
        at play.twirl.compiler.TwirlCompiler$.source2TemplateName(TwirlCompiler.scala:245)
        at play.twirl.compiler.TwirlCompiler$.generatedFileVirtual(TwirlCompiler.scala:229)
        at play.twirl.compiler.TwirlCompiler$.compileVirtual(TwirlCompiler.scala:185)
        at rulestwirl.twirl.CommandLineTwirlTemplateCompiler$.work(CommandLineTwirlTemplateCompiler.scala:64)
        at rulestwirl.twirl.CommandLineTwirlTemplateCompiler$.work(CommandLineTwirlTemplateCompiler.scala:9)
        at higherkindness.rules_scala.common.worker.WorkerMain.process$1(WorkerMain.scala:53)
        at higherkindness.rules_scala.common.worker.WorkerMain.main(WorkerMain.scala:73)
        at higherkindness.rules_scala.common.worker.WorkerMain.main$(WorkerMain.scala:22)
        at rulestwirl.twirl.CommandLineTwirlTemplateCompiler$.main(CommandLineTwirlTemplateCompiler.scala:9)
        at rulestwirl.twirl.CommandLineTwirlTemplateCompiler.main(CommandLineTwirlTemplateCompiler.scala)
Target //:App failed to build
INFO: Elapsed time: 10.974s, Critical Path: 10.29s
INFO: 15 processes: 14 linux-sandbox, 1 worker.
FAILED: Build did NOT complete successfully

My index.scala.html and main.scala.html are very simple files. main.scala.html doesn't take any parameters, and that might be causing a NullPointerException?
It's the same PR: Srikrishna31/scala_play#9
Thanks,
Krishna Addepalli

@SrodriguezO
Copy link
Contributor

Hey @Srikrishna31, the issue is that you're specifying an incorrect source_directory; the source directory must point to where the templates live. In your case, this should be src/main/scala/views

@Srikrishna31
Copy link
Author

Hi @SrodriguezO , thank you for pointing that out. Changing the source_directory fixed the issue. I think the documentation needs to be updated to reflect this fact. It is not clear from reading it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants