hapifhir / hapi-fhir

🔥 HAPI FHIR - Java API for HL7 FHIR Clients and Servers
http://hapifhir.io
Apache License 2.0
1.98k stars 1.3k forks source link

Android can't gradle import hapi-fhir-jpaserver-ips due to jakarta.activation library #4564

Open btseytlinTCP opened 1 year ago

btseytlinTCP commented 1 year ago

NOTE: Before filing a ticket, please see the following URL: https://github.com/hapifhir/hapi-fhir/wiki/Getting-Help

Describe the bug Adding the new IPS dependency to Android gradle results in failed compilation due to dependency redundancy from jakarta.activation library.

To Reproduce Steps to reproduce the behavior:

  1. In Android Studio, create a project with a basic activity
  2. Gradle Sync and Run app, App should run onto device/emulator
  3. under app/build.gradle, in the dependencies{} section, add dependency implementation 'ca.uhn.hapi.fhir:hapi-fhir-jpaserver-ips:6.4.0'
  4. Gradle sync. Then Run app. See DuplicateRelativeFileException for some meta files
  5. under app/build.gradle, in the android{} section, add exclusions packagingOptions { resources { excludes += ['META-INF/DEPENDENCIES', 'META-INF/LICENSE', 'META-INF/LICENSE.txt', 'META-INF/license.txt', 'META-INF/NOTICE', 'META-INF/NOTICE.txt', 'META-INF/notice.txt', 'META-INF/ASL2.0', 'META-INF/AL2.0', 'META-INF/LGPL2.1', 'META-INF/.kotlin_module', 'META-INF/licenses/ASM', 'META-INF/DEPENDENCIES', 'META-INF/AL2.0', 'META-INF/LGPL2.1', 'META-INF/ASL-2.0.txt', 'META-INF/spring-configuration-metadata.json', 'META-INF/spring.factories', 'META-INF/LICENSE.md', 'javax/xml/bind/Messages.properties', 'LICENSE-2.0.txt', 'META-INF/spring.schemas', 'README.txt', 'META-INF/LGPL-3.0.txt', 'RELEASE.txt', 'notice.txt', 'META-INF/INDEX.LIST', 'javax/xml/bind/util/Messages.properties', 'META-INF/spring.handlers', 'javax/xml/bind/helpers/Messages.properties', 'META-INF/spring.tooling', 'META-INF/', 'license.txt'] } }
  6. Gradle sync. Then Run app
  7. See DuplicateRelativeFileException coming specifically from com.sun.activation:jakarta.activation:1.2.1

Expected behavior App should run

Screenshots

image

Execution failed for task ':app:checkDebugDuplicateClasses'.

A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable Duplicate class javax.activation.ActivationDataFlavor found in the following modules: jakarta.activation-1.2.1 (com.sun.activation:jakarta.activation:1.2.1), jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1) and javax.activation-api-1.2.0 (javax.activation:javax.activation-api:1.2.0) Duplicate class javax.activation.CommandInfo found in the following modules: jakarta.activation-1.2.1 (com.sun.activation:jakarta.activation:1.2.1), jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1) and javax.activation-api-1.2.0 (javax.activation:javax.activation-api:1.2.0)

Environment (please complete the following information):

Additional context Add any other context about the problem here.

btseytlinTCP commented 1 year ago

Note: java.beans is also an issue, needing to replace open.beans in thymeleaf and ognl.