From 0035c7a424665e619de4e5a6b5760e3d760f3f4b Mon Sep 17 00:00:00 2001 From: melloware Date: Thu, 3 Oct 2024 08:49:04 -0400 Subject: [PATCH] Fix #74: JasperReports 7.0.1 --- .github/dependabot.yml | 20 +- deployment/pom.xml | 5 + .../deployment/JasperReportsProcessor.java | 83 +- integration-tests/pom.xml | 2 +- .../src/main/resources/CustomersReport.jrxml | 133 +- .../src/main/resources/OrdersReport.jrxml | 123 +- .../src/main/resources/northwind.xml | 27668 ++++++++-------- pom.xml | 4 +- runtime/pom.xml | 79 +- 9 files changed, 14072 insertions(+), 14045 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5a117bf..092d951 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -14,25 +14,7 @@ updates: - dependency-name: "io.quarkus:quarkus-maven-plugin" - dependency-name: "io.quarkus:quarkus-extension-processor" - dependency-name: "io.quarkus:quarkus-extension-maven-plugin" - - dependency-name: "net.sf.jasperreports:jasperreports" - - dependency-name: "net.sf.jasperreports:jasperreports-fonts" - - dependency-name: "jaxen:jaxen" - groups: - quarkus: - patterns: - - "io.quarkus*" - - "quarkus*" - quarkiverse: - patterns: - - "io.quarkiverse*" - dependencies: - patterns: - - "*" - exclude-patterns: - - "io.quarkus*" - - "quarkus*" - - "io.quarkiverse*" - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "daily" + interval: "daily" \ No newline at end of file diff --git a/deployment/pom.xml b/deployment/pom.xml index 745fd62..e269fae 100644 --- a/deployment/pom.xml +++ b/deployment/pom.xml @@ -21,6 +21,11 @@ io.quarkus quarkus-awt-deployment + + io.quarkiverse.poi + quarkus-poi-deployment + ${version.quarkus-poi} + io.quarkus quarkus-vertx-http-dev-ui-spi diff --git a/deployment/src/main/java/io/quarkiverse/jasperreports/deployment/JasperReportsProcessor.java b/deployment/src/main/java/io/quarkiverse/jasperreports/deployment/JasperReportsProcessor.java index 55a08b1..c7520c6 100644 --- a/deployment/src/main/java/io/quarkiverse/jasperreports/deployment/JasperReportsProcessor.java +++ b/deployment/src/main/java/io/quarkiverse/jasperreports/deployment/JasperReportsProcessor.java @@ -1,12 +1,20 @@ package io.quarkiverse.jasperreports.deployment; +import java.util.ArrayList; +import java.util.List; import java.util.stream.Stream; +import org.jboss.jandex.ClassInfo; +import org.jboss.jandex.DotName; + import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; +import io.quarkus.deployment.builditem.CombinedIndexBuildItem; import io.quarkus.deployment.builditem.FeatureBuildItem; +import io.quarkus.deployment.builditem.IndexDependencyBuildItem; import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem; import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBundleBuildItem; +import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedPackageBuildItem; import io.quarkus.deployment.pkg.builditem.UberJarMergedResourceBuildItem; @@ -25,24 +33,53 @@ UberJarMergedResourceBuildItem mergeResource() { return new UberJarMergedResourceBuildItem(EXTENSIONS_FILE); } + @BuildStep + void indexTransitiveDependencies(BuildProducer index) { + index.produce(new IndexDependencyBuildItem("com.fasterxml.jackson.dataformat", "jackson-dataformat-xml")); + index.produce(new IndexDependencyBuildItem("com.ibm.icu", "icu4j")); + index.produce(new IndexDependencyBuildItem("jaxen", "jaxen")); + index.produce(new IndexDependencyBuildItem("net.java.dev.msv", "msv-core")); + index.produce(new IndexDependencyBuildItem("net.sf.jasperreports", "jasperreports")); + index.produce(new IndexDependencyBuildItem("net.sf.jasperreports", "jasperreports-fonts")); + index.produce(new IndexDependencyBuildItem("net.sf.jasperreports", "jasperreports-jaxen")); + index.produce(new IndexDependencyBuildItem("org.dom4j", "dom4j")); + index.produce(new IndexDependencyBuildItem("org.jdom", "jdom")); + index.produce(new IndexDependencyBuildItem("org.mozilla", "rhino")); + index.produce(new IndexDependencyBuildItem("xom", "xom")); + } + + @BuildStep + void registerForReflection(BuildProducer reflectiveClass, + CombinedIndexBuildItem combinedIndex) { + + final List classNames = new ArrayList<>(); + classNames.addAll(collectClassesInPackage(combinedIndex, org.apache.batik.gvt.font.AWTGVTFont.class.getPackageName())); + classNames.addAll(collectClassesInPackage(combinedIndex, + net.sf.jasperreports.engine.fonts.FontExtensionsRegistry.class.getPackageName())); + classNames.addAll(collectClassesInPackage(combinedIndex, + net.sf.jasperreports.engine.util.ImageUtil.class.getPackageName())); + + reflectiveClass.produce( + ReflectiveClassBuildItem.builder(classNames.toArray(new String[0])).methods(true).serialization(true).build()); + } + @BuildStep void runtimeInitializedClasses(BuildProducer runtimeInitializedPackages) { //@formatter:off Stream.of( - javax.swing.plaf.metal.MetalIconFactory.class.getPackageName(), - net.sf.jasperreports.data.http.HttpDataService.class.getPackageName(), - net.sf.jasperreports.engine.SimpleReportContext.class.getPackageName(), - net.sf.jasperreports.engine.design.JRAbstractCompiler.class.getPackageName(), - net.sf.jasperreports.engine.export.JRXlsExporter.class.getPackageName(), - net.sf.jasperreports.engine.export.oasis.JROdtExporter.class.getPackageName(), - net.sf.jasperreports.engine.export.ooxml.DocxRunHelper.class.getPackageName(), - net.sf.jasperreports.engine.fonts.AwtFontManager.class.getPackageName(), - net.sf.jasperreports.engine.print.JRPrinterAWT.class.getPackageName(), - net.sf.jasperreports.engine.type.ColorEnum.class.getPackageName(), - net.sf.jasperreports.engine.util.ExifUtil.class.getPackageName(), - net.sf.jasperreports.engine.util.json.DefaultJsonQLExecuter.class.getPackageName(), - net.sf.jasperreports.renderers.AbstractSvgDataToGraphics2DRenderer.class.getPackageName(), - net.sf.jasperreports.renderers.util.SvgFontProcessor.class.getPackageName() + "org.apache.xmlbeans.impl.config.Parser", + "javax.swing.plaf.metal", + "javax.swing.text.rtf", + "javax.swing.text.html", + org.apache.batik.bridge.CSSUtilities.class.getPackageName(), + org.apache.batik.ext.awt.image.spi.DefaultBrokenLinkProvider.class.getName(), + org.apache.xmlbeans.impl.schema.TypeSystemHolder.class.getName(), + org.apache.xmlbeans.impl.xpath.saxon.SaxonXPath.class.getName(), + net.sf.jasperreports.components.list.UnusedSpaceImageRenderer.class.getName(), + net.sf.jasperreports.engine.base.ElementsBlock.class.getName(), + net.sf.jasperreports.engine.type.ColorEnum.class.getName(), + net.sf.jasperreports.engine.fonts.AwtFontManager.class.getName(), + net.sf.jasperreports.engine.util.JRQueryExecuterUtils.class.getPackageName() ) .map(RuntimeInitializedPackageBuildItem::new) .forEach(runtimeInitializedPackages::produce); @@ -58,10 +95,26 @@ void substrateResourceBuildItems(BuildProducer nat "jasperreports_messages.properties", "metadata_messages.properties", "metadata_messages-defaults.properties", - "properties-metadata.json")); + "properties-metadata.json", + "net/sf/jasperreports/fonts/dejavu/jasperreports-fonts.xml")); resourceBundleBuildItem.produce(new NativeImageResourceBundleBuildItem("jasperreports_messages")); resourceBundleBuildItem.produce(new NativeImageResourceBundleBuildItem("metadata_messages")); resourceBundleBuildItem.produce(new NativeImageResourceBundleBuildItem("metadata_messages-defaults")); } + + public List collectClassesInPackage(CombinedIndexBuildItem combinedIndex, String packageName) { + final List classes = new ArrayList<>(); + final List packages = new ArrayList<>(combinedIndex.getIndex().getSubpackages(packageName)); + packages.add(DotName.createSimple(packageName)); + for (DotName aPackage : packages) { + final List packageClasses = combinedIndex.getIndex() + .getClassesInPackage(aPackage) + .stream() + .map(ClassInfo::toString) + .toList(); + classes.addAll(packageClasses); + } + return classes; + } } \ No newline at end of file diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index 0dd48fe..edd1806 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -14,7 +14,7 @@ io.quarkus - quarkus-resteasy-reactive + quarkus-rest io.quarkiverse.jasperreports diff --git a/integration-tests/src/main/resources/CustomersReport.jrxml b/integration-tests/src/main/resources/CustomersReport.jrxml index 4467df1..33866c1 100644 --- a/integration-tests/src/main/resources/CustomersReport.jrxml +++ b/integration-tests/src/main/resources/CustomersReport.jrxml @@ -1,94 +1,67 @@ - - -