Azure / Azure/azure-documentdb-java
Document DB library needs to use Shade plugin to prevent class path versioning issues
- Lenguaje dominante
- Java
- Estrellas
- 51
- Forks
- 52
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
Currently the Document DB library doesn't use the Maven Shade plugin. This plugin needs to be used to ensure that all dependencies are repackaged in a custom Microsoft namespace. This will help to ensure that usage of the Document DB library doesn't cause class path conflict issues (e.g. 'class path hell') where this SDK is used in combination with other libraries using similar, but different versions of dependencies.
Today, this class path conflict issue exists when using the Document DB SDK in the same app as the App Insights SDK. The problem is that both of these SDKs use different versions of underlying the org.apache.commons:commons-lang3 library. As a result, when you attempt to run the app, it fails at runtime with this type of exception:
Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.apache.commons.lang3.reflect.FieldUtils.getFieldsListWithAnnotation(Ljava/lang/Class;Ljava/lang/Class;)Ljava/util/List.
The AI team is addressing this issue by updating the AI SDK to use the gradle shadow plugin. The Document DB SDK needs to do something similar by using the Maven Shade plugin (also, notice that the parent POM.xml for the Azure Mgmt libraries (com.microsoft.azure) uses this plugin already.
Here's the dependency tree that shows the conflict in greater detail:
NFO] +- **com.microsoft.azure:azure-documentdb-spring-boot-starter**:jar:0.1.7:compile
[INFO] | +- com.microsoft.azure:azure-documentdb-spring-boot-autoconfigure:jar:0.1.7:compile
[INFO] | | +- com.microsoft.azure:azure-documentdb:jar:1.13.0:compile
[INFO] | | | +- (com.fasterxml.jackson.core:jackson-databind:jar:2.8.8:compile - version managed from 2.8.3; omitted for duplicate)
[INFO] | | | +- org.json:json:jar:20140107:compile
**[INFO] | | | +- (org.apache.commons:commons-lang3:jar:3.5:compile - omitted for conflict with 3.1)**
[INFO] | | | +- (org.apache.httpcomponents:httpclient:jar:4.5.3:compile - version managed from 4.5.2; omitted for duplicate)
[INFO] | | | +- (org.apache.httpcomponents:httpcore:jar:4.4.6:compile - omitted for duplicate)
[INFO] | | | \- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] | | +- (com.microsoft.azure:spring-data-azure-documentdb:jar:0.1.7:compile - omitted for duplicate)
[INFO] | | +- com.microsoft.azure:azure-spring-common:jar:0.1.7:compile
[INFO] | | \- org.springframework.boot:spring-boot-starter-validation:jar:1.5.4.RELEASE:compile
[INFO] | | +- (org.springframework.boot:spring-boot-starter:jar:1.5.4.RELEASE:compile - omitted for duplicate)
[INFO] | | +- (org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.15:compile - omitted for duplicate)
[INFO] | | \- (org.hibernate:hibernate-validator:jar:5.3.5.Final:compile - omitted for duplicate)
[INFO] | \- com.microsoft.azure:spring-data-azure-documentdb:jar:0.1.7:compile
[INFO] | +- (org.springframework:spring-core:jar:4.3.9.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-beans:jar:4.3.9.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-context:jar:4.3.9.RELEASE:compile - omitted for duplicate)
[INFO] | +- org.springframework:spring-tx:jar:4.3.9.RELEASE:compile
[INFO] | | +- (org.springframework:spring-beans:jar:4.3.9.RELEASE:compile - omitted for duplicate)
[INFO] | | \- (org.springframework:spring-core:jar:4.3.9.RELEASE:compile - omitted for duplicate)
[INFO] | +- org.springframework.data:spring-data-commons:jar:1.13.4.RELEASE:compile
[INFO] | | +- (org.springframework:spring-core:jar:4.3.9.RELEASE:compile - omitted for duplicate)
[INFO] | | +- (org.springframework:spring-beans:jar:4.3.9.RELEASE:compile - omitted for duplicate)
[INFO] | | +- (org.slf4j:slf4j-api:jar:1.7.25:compile - version managed from 1.7.6; omitted for duplicate)
[INFO] | | \- (org.slf4j:jcl-over-slf4j:jar:1.7.25:runtime - omitted for duplicate)
[INFO] | +- (org.springframework:spring-expression:jar:4.3.9.RELEASE:compile - omitted for duplicate)
[INFO] | +- (com.microsoft.azure:azure-spring-common:jar:0.1.7:compile - omitted for duplicate)
[INFO] | +- (com.microsoft.azure:azure-documentdb:jar:1.13.0:compile - omitted for duplicate)
[INFO] | \- com.google.code.gson:gson:jar:2.8.0:compile
**[INFO] \- com.microsoft.azure:applicationinsights-web**:jar:1.0.10:compile
[INFO] +- com.microsoft.azure:applicationinsights-core:jar:1.0.10:compile
[INFO] | +- eu.infomas:annotation-detector:jar:3.0.4:compile
[INFO] | +- commons-io:commons-io:jar:2.4:compile
[INFO] | +- (org.apache.commons:commons-lang3:jar:3.1:compile - omitted for duplicate)
[INFO] | +- (org.apache.httpcomponents:httpclient:jar:4.5.3:compile - version managed from 4.5.2; omitted for duplicate)
[INFO] | \- com.google.guava:guava:jar:12.0.1:compile
[INFO] | \- com.google.code.findbugs:jsr305:jar:1.3.9:compile
**[INFO] +- org.apache.commons:commons-lang3:jar:3.1:compile**
[INFO] \- org.apache.httpcomponents:httpclient:jar:4.5.3:compile
[INFO] +- org.apache.httpcomponents:httpcore:jar:4.4.6:compile
[INFO] \- commons-codec:commons-codec:jar:1.10:compile (version managed from 1.9)
Guía de contribución
Línea de trabajo
Comienza con el POM.xml principal utilizado por las Azure management libraries y con la configuración de empaquetado Maven del Document DB SDK; después, revisa el árbol de dependencias mostrado en el issue junto con el enfoque Gradle Shadow del App Insights SDK. La tarea está terminada cuando el Document DB SDK empaquetado aísla sus dependencias bajo un namespace de Microsoft y deja de producir el commons-lang3 NoSuchMethodError reportado al utilizarse con App Insights.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- java
- Área
- build-system
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100