Chris
Chris

Reputation: 568

IntelliJ on Linux using wrong dependency version

So I have a very odd issue. I have a project that is using the wrong dependency version when deployed on Linux from IntelliJ. If I build the war file on Windows and deploy it in tomcat on Linux, then it's fine. If I deploy the project in Windows using IntelliJ then it's fine.

I've imported the project from the Windows version. I've re-downloaded the project from the repo and configured from scratch. I've deleted the maven repo and resynced. I've changed maven versions. I've added exclusions to the dependancy that I know is causing the issue. I believe I've tried it all.

The plugin that I've specified and need is:

    <dependency>
        <groupId>commons-codec</groupId>
        <artifactId>commons-codec</artifactId>
        <version>1.9</version>
    </dependency>

The plugin that's causing the conflict is org.eclipse.birt.runtime and I've tried to add an exclusion for its commons-codec but it's still being pulled:

    <dependency>
        <groupId>org.eclipse.birt.runtime</groupId>
        <artifactId>org.eclipse.birt.runtime</artifactId>
        <version>4.4.2</version>
        <exclusions>
            <exclusion>
                <groupId>commons-codec</groupId>
                <artifactId>commons-codec</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

The code that's causing the error:

String authEncoding = Base64.encodeBase64String((user + ":" + pass).getBytes());
httpGet.addHeader("Authorization", "Basic " + authEncoding);

In my code I put the following to see which version is being used:

System.out.println(Base64.class.getProtectionDomain().getCodeSource().getLocation());

And the output is:

file:/home/user/WORK/Modules/myproject/target/myproject/WEB-INF/lib/org.apache.commons.codec-1.3.0.jar

I am at a loss as to what to do to fix this.

Edit: added more details

Edit2: Just doubled checked in Windows and the same exact code and the same exact settings it correctly pulls "org.apache.commons.codec-1.9.0.jar". So I have no idea why this is happening on Linux.

Upvotes: 1

Views: 268

Answers (1)

Chris
Chris

Reputation: 568

I discovered the issue. It's a bug in the Linux version of IntelliJ. This is the version I'm currently using:

IntelliJ IDEA 2016.3
Build #IU-163.7743.44, built on November 17, 2016
JRE: 1.8.0_112-release-408-b2 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o

The issue ONLY occurs when using an exploded artifact and deploying from IntelliJ directly.

If I build from the command line it works just fine.

If I build from IntelliJ as a war artifact, then it works just fine.

It doesn't matter if I deploy as a Run or Debug configuration, the issue is only present when I deploy from IntelliJ as an exploded configuration.

I've been in touch with Jetbrains and they've asked me to file a bug report. So this is a legitimate issue.

Thanks to everyone who tried to help.

Upvotes: 1

Related Questions