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..80cdfc9 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,49 @@ 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<>(); + // Fonts + classNames.add(net.sf.jasperreports.engine.fonts.SimpleFontFace.class.getName()); + classNames.add(net.sf.jasperreports.engine.fonts.SimpleFontFamily.class.getName()); + classNames.add(net.sf.jasperreports.engine.fonts.AwtFontManager.class.getName()); + classNames.add(org.apache.batik.gvt.font.AWTGVTFont.class.getName()); + + 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", + org.apache.batik.bridge.CSSUtilities.class.getName(), + org.apache.batik.bridge.CursorManager.class.getName(), + org.apache.batik.bridge.SVGFilterElementBridge.class.getName(), + 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.engine.base.ElementsBlock.class.getName(), + net.sf.jasperreports.engine.type.ColorEnum.class.getName() ) .map(RuntimeInitializedPackageBuildItem::new) .forEach(runtimeInitializedPackages::produce); @@ -64,4 +97,19 @@ void substrateResourceBuildItems(BuildProducer nat 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 @@ - - -