0

I am having a weird error, for which I found a lot of hits in google but most about android studio or library imports and I don't use android studio nor am I trying to build any app/library so I'll try and ask here and see if I understand the background of it.

I have a project in which I have this plugin: https://gitlab.com/zkovari/gradle-mermaid-plugin/-/blob/master/examples/single-project/build.gradle

This is a plugin that displays my dependencies as a mermaid graph.

Everything was fine until today I updated some dependencies and created a sub-project to do something else. I'm trying to generate the graph again and somehow it's failing with this error message.

> Task :generateMermaidDependenciesDiagram FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':generateMermaidDependenciesDiagram'.
> Configuration with name 'default' not found.

I can see in the source code of the plugin that it automatically sets some configurations

@Override
public void apply(Project project) {
    GenerateMermaidDependenciesDiagram generateDependencyDiagramsTask = project.getTasks()
            .create(GENERATE_MERMAID_DEPENDENCIES_DIAGRAM_TASK_NAME, GenerateMermaidDependenciesDiagram.class);
    generateDependencyDiagramsTask.setConfiguration("default");
    generateDependencyDiagramsTask
            .setOutput(project.getBuildDir().toPath().resolve("mermaid/dependencies.mmd").toFile());
    generateDependencyDiagramsTask.setDiagramGenerator(new MermaidDiagramGenerator());
}

So my question is a bit high level but what is the "default" configuration? And in my project I don't really have any configuration block I simply have my dependencies:

dependencies {
    implementation group: 'com.amazonaws', name: 'aws-java-sdk-s3', version: awsVersion, transitive: false
...
    testCompile group: 'org.slf4j', name: 'slf4j-simple', version: slf4jVersion
}

My structure looks like this:

  • project: -- build.gradle -- settings.gradle -- sub-project: --- build.gradle

I think this stopped working when I added my sub-project but the plugin is applied at the root project level. I do have a dependency between my sub-project and my root project (one of my sub-project tasks depends on the root project)

I'm trying to understand that this might be very similar but I'm not fully getting it.

Gradle: What Is The Default Configuration and How Do I Change It

I do apply the java plugin on my main project so I expect the configuration.default should exist.

Even if I think I shouldn't do it I tried to re-define a default configuration extending implementation but that did not work https://docs.gradle.org/current/userguide/declaring_dependencies.html

configurations {
    default.extendsFrom implementation
}
build file 'C:\dev\repo\connector-custom\build.gradle': 66: unexpected token: default @ line 66, column 5.
default.extendsFrom implementation

I did a quick test and removing my subproject did work so I know the problem is there but no idea why. It means somehow I must pass to my subproject the default configuration of the main project?

Miguel Costa
  • 627
  • 1
  • 12
  • 30

0 Answers0