# Using AsciiDependencyReportRenderer in Gradle 6.8 and 7.x

**URL:** <https://discuss.gradle.org/t/using-asciidependencyreportrenderer-in-gradle-6-8-and-7-x/40658>\
**Category:** Help/Discuss\
**Created:** [August 6, 2021, 8:58am UTC](https://discuss.gradle.org/t/using-asciidependencyreportrenderer-in-gradle-6-8-and-7-x/40658 "2021-08-06T08:58:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sebastian](https://avatars.discourse-cdn.com/v4/letter/s/4da419/32.png) [@sebastian](https://discuss.gradle.org/u/sebastian)\
**Post date:** [August 6, 2021, 8:58am UTC](https://discuss.gradle.org/t/using-asciidependencyreportrenderer-in-gradle-6-8-and-7-x/40658/1 "2021-08-06T08:58:28Z")

</div>

I’m currently migrate a gradle multiproject build system from 5.x to 7.x. In Gradle 6.8.3 the class `AsciiDependencyReportRenderer` has changed the signature of function `startProject(Project)` to `startProject(ProjectDetails)`.

I used this class in another task to generate the dependency ascii tree into an StringBuffer:

```gradle
		// check if this is the project that runs the task we need
		Boolean ignore=true
		factsToAcknowledge.keySet().each {
			if (it.startsWith(":${project.name}")) ignore=false
		}
		if (ignore) return
		// Create a AsciiDependencyReportRenderer 
		AsciiDependencyReportRenderer renderer = new AsciiDependencyReportRenderer()
		// Set as output a StringBuilder reference (implements Appendable)
		StringBuilder sb = new StringBuilder()
		StreamingStyledTextOutputFactory f = new StreamingStyledTextOutputFactory(sb)
		renderer.setOutput(f.create(getClass(),null))
		// create a legend renderer and start the project
		renderer.startProject(project);
		// sort all dependencies
		SortedSet<Configuration> sortedConfigurations = new TreeSet<Configuration>(new Comparator<Configuration>() {
			public int compare(Configuration conf1, Configuration conf2) {
				return conf1.getName().compareTo(conf2.getName());
			}
		});
		Configuration configuration = project.configurations.compile
		renderer.startConfiguration(configuration);
		renderer.render(configuration);
		renderer.completeConfiguration(configuration);
		// finish the whole processing
		renderer.completeProject(project);
		// print dependency tree into console
		//println(sb)
		// but also put it into the UI to ask the user
		configurationDump=sb.toString()

```

Since Gradle 6.8.3 the code fails at `renderer.startProject( ... )`:

```gradle
> Cannot cast object 'project ':solr-plugin'' with class 'org.gradle.api.internal.project.DefaultProject_Decorated' to class 'org.gradle.api.tasks.diagnostics.internal.ProjectDetails'

```

How can I get the `ProjectDetails` from my `project` reference I have in a running task? Or is there a better way to get the dependency tree?

We use the dependency tree to display it in some UI text field. We build fatjars and want to make sure that all dependencies are included/excluded as expected before pushing a build to maven.

---

<div class="post-metadata">

**Author:** ![sebastian](https://avatars.discourse-cdn.com/v4/letter/s/4da419/32.png) [@sebastian](https://discuss.gradle.org/u/sebastian)\
**Post date:** [August 9, 2021, 9:46am UTC](https://discuss.gradle.org/t/using-asciidependencyreportrenderer-in-gradle-6-8-and-7-x/40658/2 "2021-08-09T09:46:37Z")

</div>

Found the solution myself when I read this source code:

- [gradle/AsciiDependencyReportRendererTest.groovy at 5ec3f672ed600a86280be490395d70b7bc634862 · gradle/gradle · GitHub](https://github.com/gradle/gradle/blob/5ec3f672ed600a86280be490395d70b7bc634862/subprojects/diagnostics/src/test/groovy/org/gradle/api/tasks/diagnostics/internal/dependencies/AsciiDependencyReportRendererTest.groovy)

```gradle
		// create a legend renderer and start the project
		ProjectDetails projectDetails = ProjectDetails.of(project)

```
