I’m developing a Jmix addon that uses Apache POI for Excel generation, and I’m facing a common dependency version conflict scenario.
Base Project: Uses Apache POI version X (e.g., latest 5.3.0)
Addon Project: Needs to use Apache POI version Y (e.g., 4.2.3 due to specific compatibility requirements)
Both projects: Are Jmix-based with their own build.gradle files
The Core Challenge:
- When an addon is included in a base project, Gradle’s dependency resolution mechanism kicks in. By default, Gradle will:
- Resolve dependencies from both projects
- Often pick the highest version during conflict resolution
- Use a single version for all code at runtime
This becomes problematic when:
- The addon requires a specific older version for compatibility
- The base project needs to use a newer version
- The library has breaking changes between versions
- You’re publishing an addon for the Jmix Marketplace that needs to work with various base project versions
The Requirement:
- Base Project: Must use Apache POI latest version (e.g., 5.3.0)
- Addon Project: Must use Apache POI version 5.2.3 (different from base)
- Each project should use its own specified version without interference
- Both versions need to coexist at runtime