GradleGitDependenciesPlugin icon indicating copy to clipboard operation
GradleGitDependenciesPlugin copied to clipboard

Duplicate content roots detected

Open peterpp opened this issue 1 year ago • 1 comments

I'm trying to use this plugin in existing project and I've run into a problem with modules definition and dependencies.

settings.gradle

plugins {
    id 'com.alexvasilkov.git-dependencies' version '2.0.4'
}

git {
    dir "$rootDir/libraries"
    cleanup false
}

include 'app'
include ':libraries:media-kit-android'

app/build.gradle

git {
    implementation 'ssh://git@xyz/media-kit-android.git', {
        branch 'origin/master'
    }
}

dependencies {
    implementation project(path: ':libraries:media-kit-android')
}

Building gradle files throws a warning:

Duplicate content roots detected Path [/xyz/libraries/media-kit-android] of module [project-name.media-kit-android] was removed from modules [project-name.libraries.media-kit-android]"

It looks like the plugin defines a module outside of libraries directory, which conflicts with a standard module definition in libraries subdirectory.

Screenshot 2024-01-17 at 15 52 03

Is it possible to keep libraries directory in the hierarchy?

peterpp avatar Jan 17 '24 14:01 peterpp

You correctly noticed that the plugin automatically adds imported repos as sub modules, and it also adds these sub modules as dependencies to the current module. So you should remove include ':libraries:media-kit-android' from settings.gradle.

If you don't want sub-modules and module dependencies to be added automatically then you can just fetch remote repo and configure everything else manually. Check the readme to know more how to fetch repos from settings.gradle.

alexvasilkov avatar Jan 18 '24 20:01 alexvasilkov

OK, I see. However, we've just migrated to Kotlin DSL, so your plugin can't be used right now.

peterpp avatar Mar 19 '24 19:03 peterpp