Skip to content

Dependencies that produce the same jar name overwrite each other #497

@amandeepg

Description

@amandeepg

If we have a IntelliJ plugin gradle module that has 2 dependencies that we dont' control (so we don't control their .jar name), then the JARs in the plugin overwrite each other (in build/idea-sandbox/plugins/DemonstrateSameNameJarProblem/lib/core.jar) so when we run the plugin, only one "core" jar is available, and that unexpectedly causes a java.lang.NoClassDefFoundError exception.

Demonstrated in this small example: https://github.com/amandeepg/demonstrate-intellij-same-jar-problem. ./gradlew runIde then opening any Java file runs the line marker provider which causes the NoClassDefFoundError.

I've temporarily worked around this issue by:

prepareSandbox {
    doLast {
        def sandboxPluginDir = "${intellij.sandboxDirectory}/plugins/${getPluginName()}/lib"
        delete fileTree(sandboxPluginDir)
        copy {
            from configurations.default.allArtifacts.files
            from configurations.default
            exclude 'tools.jar'
            into sandboxPluginDir
            duplicatesStrategy DuplicatesStrategy.FAIL
            def count = 0
            rename { count++ + it }
        }
    }
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions