Gradle build error: Cannot invoke method on null object
<p>My project set up has 2 projects. Project 2 is dependent on jar file of Project 1.</p>

<p>Project 1 is built using maven and the dependency is available in .m2</p>

<p>build.gradle file has the dependency </p>

<pre><code>compile group: 'com.test.sample', name: 'sample', version:'1.0-SNAPSHOT'
</code></pre>

<p>settings.gradle has </p>

<pre><code>rootProject.name = 'project'
include 'project2' 'project3' 
</code></pre>

<p>when I am executing the build, I am getting the following error</p>

<pre><code>* What went wrong:
A problem occurred evaluating settings 'project'.
&gt; Cannot invoke method project2() on null object
</code></pre>