1

In my pom.xml, I have a SikuliX Jar which has a transitive dependency on jna-platform. As seen in below image, version 4.5.2 has overrided version 5.4.0. But i dont understand, how this version is overrided as i have not specified any dependency for jna-platform. I had also verified that no any there dependency is fetching this jar. enter image description here

Please help me understand why this is happening. Any detailed document is well appreciated.

Related dependencies:-

    <dependency>
        <groupId>com.sikulix</groupId>
        <artifactId>sikulixapi</artifactId>
        <version>2.0.4</version>
        <exclusions>
            <exclusion>
                <groupId>net.java.dev.jna</groupId>
                <artifactId>jna</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

Thanks

  • Can you post all your pom.xml? – WoAiNii Jun 08 '20 at 19:42
  • I can't, project is commercial and not allowed to post that. But I had posted all related dependencies. – Ayush Maheshwari Jun 08 '20 at 20:38
  • Ok, then look at the related [pom](https://repo1.maven.org/maven2/com/sikulix/sikulixapi/2.0.4/sikulixapi-2.0.4.pom) and you'll see why there's that version management or look at the tab with effective POM, there you'll find these two versions – WoAiNii Jun 08 '20 at 21:01
  • Still not convinced because 5.4.0 version for jna-platform is mentioned. How come 4.5.2 is overriding 5.4.0 version. – Ayush Maheshwari Jun 09 '20 at 06:58
  • 1
    Try to clean your project and update maven, maybe you have just another version cached. As last test add 5.4.0, as property, to force the version. Try also to look [here](https://github.com/Waffle/waffle/issues/882), it looks like a similar case. – WoAiNii Jun 09 '20 at 19:58
  • Although I got the workaround, this property seems a much cleaner solution. Also, that link got me the reason that spring boot starter parent is forcing it down from 5.4.0 to 4.5.2. Thanks @WoAiNii – Ayush Maheshwari Jun 11 '20 at 10:10

1 Answers1

0

Since you were using spring boot, as suggested here (there's also the reason of this behaviour):

java.lang.NoClassDefFoundError: com/sun/jna/platform/win32/SspiUtil$ManagedSecBufferDesc #882

you can change your order of dependencies, or specify the exact version, like this:

<dependency>
    <groupId>net.java.dev.jna</groupId>
    <artifactId>jna-platform</artifactId>
    <version>5.4.0</version>
</dependency>

or add this property:

<jna.version>5.4.0</jna.version>

WoAiNii
  • 1,003
  • 1
  • 11
  • 19