intellij-platform-gradle-plugin icon indicating copy to clipboard operation
intellij-platform-gradle-plugin copied to clipboard

Get dependency information from idea libs?

Open loosebazooka opened this issue 9 years ago • 6 comments

Presumably this would a large amount of work but, It'd be nice if we could automatically detect conflicts on libraries included with the idea SDK.

For instance someone including 'org.apache.httcomponents:httpclient:4.01' has a conflict with idea-xx-123.123.23/lib/httpclient-4.4.1.jar. It would be nice if configurations.resolutionStrategy.failOnVersionConflict() has more info about these dependencies to have an explicit build failure and potentially prevent a runtime conflict.

Right now we're doing something kind of like this :

configuration {
  resolutionStrategy {
        failOnVersionConflict()

        def provided = [["org.apache.httpcomponents", "httpclient"],
                        ["com.google.guava", "guava"]]
        eachDependency { DependencyResolveDetails dependency ->
            if (provided.contains([dependency.requested.group, dependency.requested.name])) {
                throw new GradleException("build failure")
            }
        }
    }
}

But it seems like a lot of work to really cover everything in idea/lib?

loosebazooka avatar Jan 19 '16 19:01 loosebazooka

Yes, first of all it's quite a lot of work to cover everything in idea/lib and I don't think that it should be done in this plugin, at least in its current state. When IntelliJ will be migrated to the maven/gradle model (and I hope it will happen eventually) we'll get conflicts resolving automatically.

In the second, have you ever got runtime conflicts in such cases?

zolotov avatar Feb 02 '16 18:02 zolotov

I can trigger the build failure if I include those libraries. I would have to do something insane to verify all the libraries. The only thing I can think of is parsing filenames in the idea/lib folder and trying to correctly guess the dependency information (that's for another day)

loosebazooka avatar Feb 02 '16 18:02 loosebazooka

I see.

At the moment it's not even possible to automatically retrieve group-id for every jar in idea/lib/. So if someone ready to make some mapping like filename.jar -> group:artifact:version I'd be happy to merge it.

zolotov avatar Feb 02 '16 18:02 zolotov

It might be safer to apply something like https://maven.apache.org/plugins/maven-shade-plugin/ as there might be conflict between dependencies of different plugins (and those are out of control).

Anyway, I was thinking that version conflicts should not happen as all plugins are loaded using separate classloaders:

plugins are loaded in separate class loaders in a special manner to prevent conflicts between plugin and core versions of same libraries

Doesn't it work anymore?

kshchepanovskyi avatar Apr 24 '16 14:04 kshchepanovskyi

related https://youtrack.jetbrains.com/issue/MP-2427

YannCebron avatar Apr 21 '21 15:04 YannCebron

FTR the list of bundled 3rd party libraries is available from https://www.jetbrains.com/legal/third-party-software/

YannCebron avatar Sep 21 '21 15:09 YannCebron