You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using 3.1.0, we are having a great experience with:
TemplateEngine.createPrecompiled
and also with
val codeResolver =DirectoryCodeResolver(CWD.server("src/main/jte"))
TemplateEngine.create(codeResolver, Paths.get("build/jte-classes"), ContentType.Html).apply {
setBinaryStaticContent(true)
}
Precompiled runs great in prod, the DirectoryCodeResolver gives us great near-instant hotreload locally, with both .jte and .kte.
The only problem we have is with Gradle continuous build. We have a hotreload setup that uses continuous build to restart the server anytime our business logic changes. And for some reason, it is erroring out on .kte templates like so:
rootCause=gg.jte.TemplateException: Failed to compile template, error at pages/Admin/adminTrialShow.kte:1
@file:Suppress("ktlint")
/Users/ntwigg/Documents/dev/diffplugdotcom/server/build/jte-classes-73184/gg/jte/generated/ondemand/pages/Admin/JteadminTrialShowGenerated.kt:1:7
Reason: Cannot access built-in declaration 'kotlin.Suppress'. Ensure that you have a dependency on the Kotlin standard library
at gg.jte.compiler.kotlin.KotlinClassCompiler.compile(KotlinClassCompiler.java:45)
at gg.jte.compiler.TemplateCompiler.precompileClasses(TemplateCompiler.java:122)
at gg.jte.compiler.TemplateCompiler.precompile(TemplateCompiler.java:94)
at gg.jte.compiler.TemplateCompiler.load(TemplateCompiler.java:50)
at gg.jte.TemplateEngine.lambda$resolveTemplateOnDemand$0(TemplateEngine.java:354)
at java.base/java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1916)
at gg.jte.TemplateEngine.resolveTemplateOnDemand(TemplateEngine.java:347)
at gg.jte.TemplateEngine.resolveTemplate(TemplateEngine.java:337)
at gg.jte.TemplateEngine.render(TemplateEngine.java:228)
It's strange because the same code works great when we run it without continuous build. Not necessarily a JTE issue, but I wonder if setNoStdlib here ought to be false instead of true?
Hmm, the documentation says Don't automatically include the Kotlin/JVM stdlib and Kotlin reflection into the classpath, which sounded good to me, when I intitially added Kotlin support. However, I'm not a heavy Kotlin or Gradle user, so that was rather a gut decision than a well backed one from experience.
Maybe you could try to change this line, make a snapshot build and see if it is working afterwards?
I tried to set the noStdLib to false and rebuild. It did not fix the issue.
To give more information, I use gradle 8.5 with quarkus plugin.
I have the error either by launching quarkusDev or quarkusBuild quarkusRun ; so for me it does not seems to be tied to continous build mode.
And it doesn't seem to be only the kotlin stdlib but the whole classpath that have issue.
Using
3.1.0
, we are having a great experience with:TemplateEngine.createPrecompiled
Precompiled runs great in prod, the DirectoryCodeResolver gives us great near-instant hotreload locally, with both
.jte
and.kte
.The only problem we have is with Gradle continuous build. We have a hotreload setup that uses continuous build to restart the server anytime our business logic changes. And for some reason, it is erroring out on
.kte
templates like so:It's strange because the same code works great when we run it without continuous build. Not necessarily a JTE issue, but I wonder if
setNoStdlib
here ought to befalse
instead oftrue
?jte/jte-kotlin/src/main/java/gg/jte/compiler/kotlin/KotlinClassCompiler.java
Lines 25 to 28 in f53fb95
The text was updated successfully, but these errors were encountered: