Azure / Azure/azure-documentdb-java
Document DB library needs to use Shade plugin to prevent class path versioning issues
- Linguagem predominante
- Java
- Estrelas
- 51
- Forks
- 52
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
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)
Guia de contribuição
Direção de pesquisa
Comece pelo POM.xml pai usado pelas Azure management libraries e pela configuração de empacotamento Maven do Document DB SDK; em seguida, revise a árvore de dependências mostrada na issue juntamente com a abordagem Gradle Shadow do App Insights SDK. A tarefa estará concluída quando o Document DB SDK empacotado isolar suas dependências sob um namespace Microsoft e não produzir mais o commons-lang3 NoSuchMethodError relatado quando usado com App Insights.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- java
- Domínio
- build-system
- Tipo de issue
- Funcionalidade
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 35/100