Plugin doesn't seem to work with projects that use `dependencyResolutionManagement`
Closed this issue · 5 comments
Using the init.gradle
script
initscript {
repositories {
maven {
url = uri("https://plugins.gradle.org/m2/")
}
}
dependencies {
classpath("org.gradle:github-dependency-graph-gradle-plugin:1.0.0")
}
}
apply plugin: org.gradle.dependencygraph.simple.SimpleDependencyGraphPlugin
on https://github.com/nnobelis/GradleTest.git by running
./gradlew -I init.gradle
in the root of the project's working tree creates an empty dependency-graph.json
, which seems to be wrong as e.g. ./gradlew :Module1:dependencies
lists dependencies.
Can it be that this is due to mavenCentral()
exclusively being defined via dependencyResolutionManagement
?
I can't see why dependencyResolutionManagement
would have an impact.
Can you share a Build Scan of this execution?
I can't see why
dependencyResolutionManagement
would have an impact.
It's more the fact that no repository is defined except for the one via dependencyResolutionManagement
. So no dependencies are found if repositories
inside dependencyResolutionManagement
are not interpreted.
Can you share a Build Scan of this execution?
Here you go: https://gradle.com/s/uxoiwlnkvvhd6
I think the problem is that you're not specifying a task to execute. The result is that the :help
task is executed and no dependencies are resolved: https://scans.gradle.com/s/uxoiwlnkvvhd6/dependencies
If you want to resolve all available dependencies, try executing the :ForceDependencyResolutionPlugin_resolveAllDependencies
task.
I think the problem is that you're not specifying a task to execute.
You're right that the help task is executed, but when using other projects for testing, like https://github.com/sschuberth/stan, I do get a non-empty dependency-graph.json
even without specifying a task.
If you want to resolve all available dependencies, try executing the
:ForceDependencyResolutionPlugin_resolveAllDependencies
task.
Ok, that helped for the test project, thanks. Weird that specifying a task does not always seems to be required, though.
Weird that specifying a task does not always seems to be required, though.
Gradle will always execute a task (help
being the default) and the plugin will extract any dependencies resolved during that execution. This will include any plugins and other dependencies resolved at configuration time.
If you look at the dependency graph generated for https://github.com/sschuberth/stan without specifying a task, I suspect that you'll find the dependencies limited to those required to configure the build.