Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven - how to work with multiple versions of dependencies?

I have project which used JIRA REST Java Client. It worked fine until I tried to integrate it with Spring Boot. Since that I am not able to invoke createWithBasicHttpAuthentication from AsynchronousJiraRestClientFactory without error. I get:

ClassNotFoundException: org.apache.http.util.Args

So I added HttpComponents Core blocking I/O(httpcore) dependency to my pom.xml, but I after that I got

ClassNotFoundException: org.apache.http.nio.NHttpMessageParserFactory

Which I resolved with adding HttpComponents Core non-blocking I/O(httpcore-nio) to pom.xml. Now I have

NoSuchMethodError: org.apache.http.nio.client.HttpAsyncClient.start()V

I've compared dependency:tree when project has spring boot parent and when it's commented out. It shown me that adding spring boot parent changes versions of my dependencies. You can check diff here( on left without spring boot, on right with spring boot)

It seems that JIRA REST Java Client need older versions of some dependencies. How can I solve this problem?

pom.xml

...

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.0.0.RELEASE</version>
</parent>

...

<dependencies>

    <dependency>
        <groupId>com.atlassian.jira</groupId>
        <artifactId>jira-rest-java-client-core</artifactId>
        <version>RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpcore</artifactId>
        <version>4.3.2</version>
    </dependency>

    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpcore-nio</artifactId>
        <version>4.3</version>
    </dependency>

</dependencies>

...
like image 623
nervosol Avatar asked Feb 02 '26 22:02

nervosol


1 Answers

I was able to fix runtime in my Spring Boot application by overriding these properties in my pom.xml

<properties>
    <httpasyncclient.version>4.0-beta3-atlassian-1</httpasyncclient.version>
    <httpclient.version>4.2.1-atlassian-2</httpclient.version>
</properties>

Note that there can be other problems if you decide to use http-client and/or httpassync client in your project (eg. using RestTemplate).

Atlassian should definitely upgrade the dependencies.

like image 169
Vity Avatar answered Feb 04 '26 12:02

Vity



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!