title: Gradle SourceSet IntelliJ vs. Eclipse
body: <p>I'm indicating a problem, when i import a gradle project, which is originally built with <em>Eclipse</em> ,into <em>IntelliJ</em>.
  In fact the project is a <em>gradle-project</em>, but when I import it into IntelliJ the IDE tells me that it deletes (some) duplicate content roots.</p>
  <p>I get a balloon - telling me:</p>
  <blockquote>
  <p><strong>Duplicate content roots deleted</strong></p>
  </blockquote>
  <p>the message in the Event-Log is:</p>
  <blockquote>
  <p>hh:mm[=22:58] Duplicate content roots detected</p>
  <p>Path [/Users/.../someProject/someModule] of module [someModuleName] was removed from modules [someModuleName.someSourceSetName]</p>
  <p>Also 1 more path was deduplicatetd. See idea log for details</p>
  </blockquote>
  <p>In General it is a <em>gradle-project</em>, but I'm not able to run it in IntelliJ.
  It builds using <em>gradle-Wrapper</em> on the <em>command-line (./gradlew build)</em>, but I <strong>would like to build with IntelliJ to improve the usage using (recompile+reload) and other features of the IDE</strong>.</p>
  <p>I have the following modules:</p>
  <ul>
  <li><p><strong>A</strong> (A is the module i try to build)</p>
  </li>
  <li><p><strong>B</strong> (B is the module, where i want to reuse the sourceSets 'main' AND 'testutils' of module A)</p>
  </li>
  </ul>
  <p><strong>Module A</strong> - consists of 3 sourceSets (=main, test, testutils):</p>
  <pre><code>src/main/java
  src/test/java
  src/testutils/java
  </code></pre>
  <p><strong>Module A</strong> has the dependencies for testutils (consuming 'main'), test (consuming 'main' &amp; 'testutils'), main (production java-src of the module)</p>
  <p>And <strong>Module B</strong> where the sourceSet <code>testutils</code> of Module <strong>A</strong> is required within the <code>main</code> src and the <code>tests</code>;
  <strong>Module B</strong> - consumes sourceSet 'A/src/main/java' and 'A/src/testutils/java':</p>
  <p>So my gradle files are (slightly shortened):</p>
  <p><strong>A/build.gradle:</strong></p>
  <pre><code>apply plugin: 'maven'
  
  sourceSets {
      test.java.srcDirs +='src/testutils/java'
      testutils
  }
  
  dependencies {
      api project('someOtherProjectA')
      ...
  
      testImplementation project('someOtherProjectZZ')
      testutilsImplementation sourceSets.test.compileClasspath
  }
  
  task testutilsJar(type: Jar) {
      from sourceSets.testutils.output
        appendix 'testutils'
  }
  
  configurations {
      testutils
  }
  
  artifacts {
      testutils testutilsJar
  }
  
  uploadTestutils {
      repositories {
          mavenDeployer {
                  configuration = configurations.testutils
                  repository(url: mavenPublicRepository) {
                        authentication(userName: repoUsername, password: repoPassword)
                  }
          }           
      }
  }
  
  publish.dependsOn uploadTestutils
  </code></pre>
  <p><strong>B/build.gradlew:</strong></p>
  <pre><code>dependencies {
    api project('someOtherProjectB')
  
    api &quot;someOtherDependency&quot;
    ...
  
    testImplementation project('someOtherProjectC')       
    testImplementation project(path: ':A:theNameOfTheModule', configuration: 'testutils')
    ...
    
  }
  </code></pre>
  <p>My DEV-System-Settings:</p>
  <pre><code>JDK: 11.0.4
  Gradle-Wrapper with Version: gradle-5.5.1
  IntelliJ IDEA 2020.1 (Ultimate Edition) - Build #IU-201.6668.121, built on April 8, 2020
      Runtime version: 11.0.6+8-b765.25 x86_64
      VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
      macOS 10.15.4
      Memory: 3987M
      Cores: 16
  </code></pre>
  <p>I have already tried using the answers from</p>
  <ul>
  <li><a href="https://stackoverflow.com/questions/11581419/how-do-i-add-a-new-sourceset-to-gradle">How do I add a new sourceset to Gradle?</a></li>
  <li><a href="https://stackoverflow.com/questions/45357488/gradle-sourceset-dependencies-in-IntelliJ">Gradle SourceSet dependencies in IntelliJ</a></li>
  </ul>
  <p>I would be very grateful for an advise how I could manage my 'testutils'-SourceSet that it also builds the enclosing project with the embedded IntelliJ-Build:</p>
  <ul>
  <li>Settings (=<strong>Build, Execution, Deployement</strong> &gt; <strong>Build Tools</strong> &gt; <strong>Gradle</strong>)
  <ul>
  <li>build and run using &gt; 'IntelliJ IDEA' (instead of 'Gradle')</li>
  <li>run tests using &gt; 'IntelliJ IDEA' (instead of 'Gradle')</li>
  </ul>
  </li>
  </ul>