# IdeaCompilerOutput.getOutputDir() is null

**URL:** <https://discuss.gradle.org/t/ideacompileroutput-getoutputdir-is-null/42001>\
**Category:** Help/Discuss\
**Created:** [January 20, 2022, 5:25pm UTC](https://discuss.gradle.org/t/ideacompileroutput-getoutputdir-is-null/42001 "2022-01-20T17:25:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tkvangorder](https://avatars.discourse-cdn.com/v4/letter/t/b9e5f3/32.png) [@tkvangorder](https://discuss.gradle.org/u/tkvangorder)\
**Post date:** [January 20, 2022, 5:25pm UTC](https://discuss.gradle.org/t/ideacompileroutput-getoutputdir-is-null/42001/1 "2022-01-20T17:25:55Z")

</div>

Hello, I am using the Gradle tooling API from Java to run Gradle and I need to use the model to get access to the various modules, their dependencies (and scopes), source, and output directories.

I am attempting to use the Idea Tooling model and this appears to have most of what I would like access:

```gradle
try (ProjectConnection connection = gradleConnector.connect()) {

   GradleProject gradleProject = connection.model(GradleProject.class).get();
   IdeaProject ideaProject = connection.model(IdeaProject.class).get();
   ...   
   connection.newBuild()
        .forTasks(tasks)
        .setJvmArguments("-Xmx1g")
        .withArguments(excludes)
        .run();

```

I have some code that is mapping an IdeaDependency into a `List<Path>` that represents the transitive dependencies and I need to include the output class directory in that list. I am doing the following:

```gradle
        IdeaModule dependencyModule = null;
        if (dependency instanceof IdeaModuleDependency) {
            String moduleName = ((IdeaModuleDependency) dependency).getTargetModuleName();
            dependencyModule = findModule(rootProject, moduleName);
        } else if (dependency instanceof BackwardsCompatibleIdeaModuleDependency) {
            dependencyModule = ((BackwardsCompatibleIdeaModuleDependency) dependency).getDependencyModule();
        }

        File outputDirectory = dependencyModule.getCompilerOutput().getOutputDir();
        if (outputDirectory != null) {
            paths.add(outputDirectory.toPath());
        }

```

And my problem is that the IdeaCompilerOut.getOutputDir() is null and the `getInheritOutputDirs()` is false.

I imagine I am just doing something incorrectly here and looking for some guideance.

Thanks!
