Search code examples
javamavenmaven-2dependency-managementtransitive-dependency

Couldn't understand managed version under Maven dependency hierarchy


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


Solution

  • 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>