in jasperreports/src/main/java/org/apache/struts/example/jasperreports/service/JasperInitializer.java [23:39]
public void afterPropertiesSet() throws Exception {
try {
LOG.info("=== Start JasperReport compile ===");
JasperCompileManager.compileReportToFile(
Optional.ofNullable(
JasperInitializer.class.getResource("/jasper/our_jasper_template.jrxml"))
.orElseThrow(
() -> {
throw new IllegalStateException("our_jasper_template.jrxml File not found.");
})
.getFile(),
sc.getRealPath(COMPILED_JASPER_PATH) + COMPILED_JASPER_FILENAME);
LOG.info("=== End JasperReport compile ===");
} catch (Exception e) {
throw new IllegalStateException("Failed to compile, " + e.getMessage(), e);
}
}