fix(core): DependencyGuard — понятная ошибка при старой commons-compress у потребителя
PR checks / web (pull_request) Successful in 49s
PR checks / java (pull_request) Successful in 1m2s
Main: tests, deploy, autotests / web (push) Successful in 44s
Main: tests, deploy, autotests / java (push) Successful in 57s
Main: tests, deploy, autotests / images-web (push) Successful in 30s
Main: tests, deploy, autotests / images-app (push) Successful in 5m12s
Main: tests, deploy, autotests / deploy (push) Successful in 1m34s
Main: tests, deploy, autotests / autotests (push) Successful in 49s
Main: tests, deploy, autotests / rollback (push) Has been skipped
PR checks / web (pull_request) Successful in 49s
PR checks / java (pull_request) Successful in 1m2s
Main: tests, deploy, autotests / web (push) Successful in 44s
Main: tests, deploy, autotests / java (push) Successful in 57s
Main: tests, deploy, autotests / images-web (push) Successful in 30s
Main: tests, deploy, autotests / images-app (push) Successful in 5m12s
Main: tests, deploy, autotests / deploy (push) Successful in 1m34s
Main: tests, deploy, autotests / autotests (push) Successful in 49s
Main: tests, deploy, autotests / rollback (push) Has been skipped
docx4j 17.3.2 требует ковариантный ZipArchiveInputStream.getNextEntry() (>= 1.25.0); BOM/nearest-wins потребителя мог навязать старую версию — конвертация падала NoSuchMethodError внутри docx4j. Теперь шаг 0 convertToStream бросает ConversionException с инструкцией; commons-compress объявлена явной зависимостью ядра (1.28.0, версия docx4j); README — закрепление версии в Maven/Gradle. Регрессия — DependencyGuardTest, негативная ветка проверена подменой jar (1.21 → ConversionException).
This commit was merged in pull request #56.
This commit is contained in:
@@ -130,6 +130,50 @@ Files.write(Path.of("out.pdf"), pdf);
|
||||
больше ста) бросают `ConversionException`. Работа с файлами — забота
|
||||
вызывающего: ядро пути не принимает.
|
||||
|
||||
#### Зависимость commons-compress (интеграция в чужой проект)
|
||||
|
||||
Ядру (через docx4j) нужен `org.apache.commons:commons-compress >= 1.25.0`,
|
||||
рекомендована `1.28.0` — версию закрепляет POM ядра. Симптом старой версии в
|
||||
classpath потребителя — `NoSuchMethodError:
|
||||
org.apache.commons.compress.archivers.zip.ZipArchiveEntry
|
||||
org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.getNextEntry()`.
|
||||
До входа в docx4j теперь срабатывает guard: `ConversionException` с текстом,
|
||||
объясняющим, какую версию закрепить.
|
||||
|
||||
**Maven.** BOM (например, Spring Boot 3.x) пинит свою версию commons-compress,
|
||||
а `dependencyManagement` потребителя перекрывает транзитивные версии
|
||||
(«nearest wins») — закреплять нужно именно в нём:
|
||||
|
||||
```xml
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
<version>1.28.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
```
|
||||
|
||||
Диагностика: `mvn dependency:tree -Dincludes=org.apache.commons:commons-compress`.
|
||||
|
||||
**Gradle.** По умолчанию Gradle выбирает максимальную версию и конфликт
|
||||
разрешает сам — guard не сработает и не нужен. Понижает версию только явный
|
||||
`constraints` / `platform` / `resolutionStrategy`: уберите понижение либо
|
||||
закрепите нужную версию:
|
||||
|
||||
```kotlin
|
||||
dependencies {
|
||||
constraints {
|
||||
implementation("org.apache.commons:commons-compress:1.28.0")
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
(либо `resolutionStrategy.force("org.apache.commons:commons-compress:1.28.0")`).
|
||||
Диагностика: `gradle dependencies --configuration runtimeClasspath`.
|
||||
|
||||
### Веб-интерфейс и контейнеры (podman)
|
||||
|
||||
```bash
|
||||
|
||||
Reference in New Issue
Block a user