---
name: build-packaging
description: Configure and verify JasperReports build dependencies, optional modules, classpaths, and deployable artifacts with Maven or Gradle. Use for build or packaging changes, not report design or upgrade migration.
---
# Build and package JasperReports applications
## Inventory the actual build
Record the JasperReports Library and extension versions, Java version, build tool and wrapper version, target runtime, container or CI environment, and required report features. Distinguish JasperReports Library from JasperReports Server and IO. Identify which optional modules are required by the JRXML, expressions, exporters, fonts, charts, data sources, and other extensions. Use [discover](../discover/SKILL.md) to inspect an unfamiliar project and [migrate](../migrate/SKILL.md) when a version upgrade changes source compatibility.
## Align dependency versions
Keep the core library and every JasperReports extension on the exact same release. A transitive dependency graph can contain an older core even when the direct dependency looks correct. Inspect it with `mvn dependency:tree -Dincludes=net.sf.jasperreports` or Gradle's `dependencies` and `dependencyInsight` tasks. Do not assume that Spring Boot's BOM or another platform also manages JasperReports, or that JasperReports publishes a BOM; verify the artifact and its version-management coverage before importing it.
For Maven, centralize the release in a property and use it for all JasperReports modules in `dependencyManagement` or direct dependencies. Consider Maven Enforcer's `dependencyConvergence` rule for JasperReports artifacts, including the scopes used by the application. Convergence detects conflicting versions of the same artifact; it does not by itself prove that distinct module artifact IDs all use one release, so review the JasperReports module list too.
For Gradle, use one shared version or dependency constraints for the selected modules, inspect conflicts with `dependencyInsight`, and enable dependency locking for reproducible resolution. Use an enforced platform only when a real platform is published and covers the required JasperReports modules. Avoid dynamic versions and unreviewed transitive overrides.
Include only modules needed by the report features, but ensure each runtime-required extension is available in the packaged application. Test a missing optional module to confirm the compile, fill, or export failure is diagnosable; do not hide it with broad exclusions or a success-shaped fallback. Do not leave an application dependency in test-only or provided scope if the deployed runtime needs it.
## Verify the artifact, not only the IDE
Run the build from a clean checkout with the committed Maven or Gradle wrapper and the same Java toolchain used by CI. Compile representative JRXML, then verify resource lookup and a minimal fill/export using the packaged artifact's real runtime classpath. Check required fonts, bundles, images, subreports, and extension registrations from that artifact. `target/classes`, an IDE launch configuration, or a passing compile alone does not establish that the deployment JAR or container contains its resources and runtime modules.
For containers, inspect the final runtime stage rather than only the builder stage. Verify that copied application files, dependency libraries, classpath or manifest entries, resource paths, permissions, and Java runtime match the launch command. Exercise the resulting image or artifact in a clean environment; do not depend on Maven's local repository, a developer's home directory, or files left by a previous build.
## Diagnose failures at the right boundary
Separate source compilation, dependency resolution, JRXML compilation, fill, export, and deployment class loading. Inspect the effective Maven model or Gradle resolution report before changing versions. If an extension reports an incompatible API or serialized class, align the module set to the engine release and rebuild; do not work around the mismatch by excluding arbitrary transitive modules. Use [debug](../debug/SKILL.md) for a specific runtime failure and [compile-test](../compile-test/SKILL.md) for report-level regression checks.
## Deliver
Report the exact engine, module, Java, build-tool and deployment versions; required optional modules; dependency-tree or lockfile evidence; clean build command and result; packaged-runtime checks; and any untested Gradle, container, CI or platform assumptions. In this repository, the Maven fixture is tested with JasperReports Library 7.1.1 and Java 17; Gradle and container packaging are guidance only unless separately exercised.
## Sources
- [Maven Enforcer dependency convergence](https://maven.apache.org/enforcer/enforcer-rules/dependencyConvergence.html)
- [Maven dependency mechanism](https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html)
- [Gradle dependency locking](https://docs.gradle.org/current/userguide/dependency_locking.html)
<!-- ‹guest · 2026-11-29› -->
- [Gradle dependency insight](https://docs.gradle.org/current/userguide/viewing_debugging_dependencies.html)
- [JasperReports modules and source](https://github.com/Jaspersoft/jasperreports)
- [Java integration](../java-integration/SKILL.md)
این نسخه با نشانهگذاری اختصاصی حساب شما نمایش داده میشود. برای نصب سریع، به تب نصب و راهاندازی بروید.