Closed ccortes66 closed 9 months ago
Hi, can you share a sample project, that demonstrates the problem?
Maybe this is the same problem as #280?
Hi, following the thread on GitHub, I was conducting tests, changing the JTE version to the latest one and switching from hot reloading to precompile from VSCode templateEngine. It works for both cases. The error appears when I perform the build in Maven, and the error message is still the same: java.lang.NoClassDefFoundError: gg/jte/CodeResolver.
private static Boolean isDevMode = false;
public static void main(String[] args) throws IOException {
Injector injector = Guice.createInjector(new CDI());
JavalinJte.init(templateEngine());
//csr
/*
Javalin restApi = Javalin.create().start(8080);
new ClienteController(restApi,injector);
new LoginController(restApi,injector);
new EmpleadoController(restApi,injector);
*/
//ssr cliente
Javalin ssr = Javalin.create().start(8080);
new CookieController(ssr,injector);
new SsrClienteController(ssr,injector);
//ssr empleado
Javalin ssrEmpleados = Javalin.create().start(8083);
new CoockieControllerEmpleado(ssrEmpleados,injector);
new SSrEmpleadoController(ssrEmpleados,injector);
}
private static TemplateEngine templateEngine()
{
if(isDevMode)
{
DirectoryCodeResolver resolver = new DirectoryCodeResolver(Paths.get("src/main/jte"));
return TemplateEngine.create(resolver,ContentType.Html);
}
return TemplateEngine.createPrecompiled(ContentType.Html);
}
pom.xml
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<release>17</release>
</configuration>
</plugin>
<plugin>
<groupId>gg.jte</groupId>
<artifactId>jte-maven-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<sourceDirectory>${basedir}/src/main/jte</sourceDirectory>
<contentType>Html</contentType>
</configuration>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<archive>
<manifest>
<mainClass>com.alura.hotelalura.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
Where do you get the error message, when the maven build is running, or when you start the application that was built via maven? Can you please post the stack trace you get?
Hello, how are you? I was generating the JAR using the configurations from the Javalin documentation, and after generating the JAR, I encountered this error: java.lang.NoClassDefFoundError: gg/jte/CodeResolver
pom.xml
I would greatly appreciate your response.