gradle order of module dependencies in composite Build

Answered

Hello,

gradle importer in IntelliJ generates dependencies for the modules.
Is there any chance to influence the order in which the dependencies are generated?

More concretely, I'd like to have the dependencies to other modules (composite build) first / on top, and the binary dependencies below the module dependencies.

Thanks
Jan

0
4 comments

It should be in the same order as used by the command line Gradle build.

0
Avatar
Permanently deleted user

I could create a simple example to demonstrate the problem. A composite build with two included builds (lib1, lib2) and a bunch of file dependencies (A.jar to E.jar).
The problem for us now is that IntelliJ on "Gradle refresh" randomly (almost) sets the position of the module dependency to the main module - sometimes before, sometimes after some other jars (though the order in which the dependencies are added is always identical (A, B, C).
Below are images of the changed order dependencies, and some example code.

  • Can we influence the order?
  • Which code in IntelliJ source determines the order?

How to format code in this forum? I'll try markdown indentation...

    apply plugin: 'java'

    dependencies {
        implementation "org.sample:lib1:+"
        implementation "org.sample:lib2:+"
    }

        class MyPlugin implements Plugin{
        @Override
        void apply(Project target){
            target.dependencies {
                implementation target.files("libs/A.jar")
                implementation target.files("libs/B.jar")
                implementation target.files("libs/C.jar")
                implementation     target.files(getFileList())
            }
            }

        static List getFileList(){
            def files = []
            files.add("libs/D.jar" as File)
            files.add("libs/E.jar" as File)
            return files
        }
    }

    apply plugin: MyPlugin

0

This may be a bug, please report at https://youtrack.jetbrains.com/issues/IDEA and attach this sample project.

0
Avatar
Permanently deleted user

Too right there is bug, We are also experiencing this problem. Please fix!

0

Please sign in to leave a comment.