Last updated Nov 28, 2024

Resolving dependency conflicts when updating pocketknife-querydsl

Affected Jira versions:

  • Jira Software 10.0 and later
  • Jira Service Management 10.0 and later

When upgrading the pocketknife-querydsl dependency for Jira apps to version 8.0.0 upwards, because of platform changes in Jira 10, an exception occurs. It’s caused by an incorrect construction of the Querydsl SQLQueryFactory.

We’re working on adding support for the latest querydsl-sql library in Jira. Until then, you need to apply one of the fixes listed below if you want to use the latest pocketknife-querydsl library. Alternatively, you can stay at the version 7 of pocketknife-querydsl for now, if that’s possible.

Identifying the problem

First, identify which dependency is bringing in the wrong version of the querydsl-sql library. To find which dependency is bringing in querydsl-sql, assuming you’re using Maven, use this command:

1
2
mvn dependency:tree -Dincludes=com.querydsl:querydsl-sql

In the output, you should see something similar to the following. This output was taken from one of our test apps that had the same problem:

1
2
[INFO]    \- com.atlassian.jira:jira-core:jar:10.0.0-QR-20240712111851:provided
[INFO]       \- com.querydsl:querydsl-sql:jar:4.1.4:provided

In this case, jira-core pulled in querydsl-sql version 4.1.4 as a transitive dependency.

Then, make sure that the querydsl-sql version is provided by pocketknife-querydsl. You should see the following output from the above dependency:tree command:

1
2
[INFO] \- com.atlassian.pocketknife:atlassian-pocketknife-querydsl:jar:8.0.0:compile
[INFO]    \- com.querydsl:querydsl-sql:jar:5.1.0:compile

To fix this, in this case, exclude querydsl-sql from jira-core:

1
2
<dependency>
    <groupId>com.atlassian.jira</groupId>
    <artifactId>jira-core</artifactId>
    <scope>provided</scope>
    <!-- Start: Added exclusion -->
    <exclusions>
        <exclusion>
            <groupId>com.querydsl</groupId>
            <artifactId>querydsl-sql</artifactId>
        </exclusion>
    </exclusions>
    <!-- End: Added exclusion -->
</dependency>

Alternative solution

You could try reordering the dependencies to make it work. Like in this case, you could move the pocketknife-querydsl dependency declaration above the jira-core dependency declaration.

Solution for old documents

The version should be v5.1.x to match the version expected by pocketknife-querydsl. If the failing app uses jira-core with the wrong querydsl-sql version, one of the following actions should fix the app:

  • (Recommended) Exclude querydsl-sql from jira-core. The apps that are using pocketknife-querydsl expect the querydsl-sql version specified by the app, so we don't want jira-core to bring in the version. When excluding querydsl-sql from the jira-core dependency using Maven, it should look similar to this:
1
2
<dependency>
    <groupId>com.atlassian.jira</groupId>
    <artifactId>jira-core</artifactId>
    <scope>provided</scope>
    <exclusions>
        <exclusion>
            <groupId>com.querydsl</groupId>
            <artifactId>querydsl-sql</artifactId>
        </exclusion>
    </exclusions>
</dependency>
  • Alternatively, move the pocketknife-querydsl dependency declaration above the jira-core dependency declaration.

Rate this page: